fluent-bit: `modify` filter does not respect nested keys
Bug Report
Describe the bug
modify
filter does not respect nested keys
To Reproduce
- Config:
[SERVICE] Flush 1 Daemon Off Log_Level debug Parsers_File parsers.conf [INPUT] Name tail Path /log.json [FILTER] Name parser Match * Key_Name log Parser test [FILTER] Name modify Match * Condition Key_exists json Copy json.Message log [OUTPUT] Name stdout
- Example log message if applicable:
{ "json": { "Message": "HttpClientTracingProvider:: Class is receiving HTTP Response from using .: StatusCode=200 Elapsed=00:00:00.0078867 ResponseHeaders={$Headers} ResponseBody={$Body}" } }
- Steps to reproduce the problem: Just run fluent-bit with config attached.
Expected behavior
json.Message
contents should be copied to log
key.
Screenshots
Your Environment
- Version used: 1.3.7, 1.4.3
- Configuration: provided above
- Environment name and version (e.g. Kubernetes? What version?): docker 19.03.8
- Server type and version: -
- Operating System and version: MacOS 10.15
- Filters and plugins: -
Additional context
Non-nested keys are working fine
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 44
- Comments: 35 (5 by maintainers)
Still a valid issue, commenting so this doesn’t get closed.
Not sure how you would support this perfectly without a new parameter with a json path. I’ve used nest like this, hopefully this helps people.
But you can simply turn it off
This issue is still valid, why isn’t this issue not labeled as a bug?
I have the same issue ! i running fluent-bit from container image 1.8.6 latest
Input
Remove the nested key
user.group
not workThis is still an issue. It’s quite hard to maintain proper lua scripts for this. Would be nice to have native config to support kubernetes metadata manipulation.
Anyone found a way out? Any relation with https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/record-accessor?
Yea that might work for some people. I found the easiest was to set the kubernetes plugin filter to annotations off and lables off See docs for more details: https://docs.fluentbit.io/manual/pipeline/filters/kubernetes
I encountered a similar issue and i managed to resolve it using a super simple lua script, hope it helps:
and you use it like this:
Still a problem. I’d like to remove some kubernetes.examplekey but the filter doesn’t respect nested keys. record_modifier has the same problem
Hello, I ended up there trying to clean most Kubernetes keys while still collecting all of them for a separate output. My version is 2.2.1 (using debug Docker image) and the following config still don’t work:
I’m trying to keep
log
,kubernetes.pod_name
,kubernetes.container_image
andkubernetes.host
, but the only key remaining in the end islog
😢 I think I will have to use the Lua workaround, but it’s really sad for such a basic task…Hi friends,
for anyone else who’s bumping into this, I came up with the following solution using the lua filter:
Inline the Lua code to have everything in one place, unfortunately that hurts readability a bit. The Lua code is as follows:
(to delete an item from a Lua table, one has to set the value to
nil
: https://stackoverflow.com/questions/1758991/how-to-remove-a-lua-table-entry-by-its-key )This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the
exempt-stale
label.This problem is still actual not only for the
modify
plugin but GELF output plugin also. I cannot set a nested key forGelf_Host_Key
parameter.The issue still exist in 1.7 😦
Can confirm this still does not work on v1.5.2. What I’m doing to work around, for now, is using the
nest
filter tolift
records up and then process withrename
. This isn’t optimal, though, as I’d ideally only like to lift 1 or 2 keys rather than the whole nested structure.