-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter_nest: add wildcard_exclude config #10112
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Greg Eales <[email protected]>
Example config: pipeline:
inputs:
- name: dummy
tag: logs
dummy: |
{
"message": "simple log generated",
"logger": "my.logger",
"level": "INFO",
"hostname": "localhost",
"my_map_of_attributes_1": {
"key_1": "hello, world!",
"key_2": "goodbye, world!"
},
"my_map_of_maps_1": {
"root_key": {
"sub_key_1": "hello, world!",
"sub_key_2": "goodbye, world!"
}
},
"an_unknown_key": "hello, world!",
"another_unknown_key": "goodbye, world!"
}
filters:
- name: nest
match: logs
nest_under: nested
wildcard: '*'
wildcard_exclude:
- message
- logger
- hostname
- level
- 'my_map_of_*'
outputs:
- name: stdout
match: logs The above will nest keys |
Here is some console output, showing how the above example config produces the correct output:
|
|
||
if (wildcard_exclude->key_is_dynamic) { | ||
/* This will negatively match "ABC123" with prefix "ABC*" */ | ||
if (strncmp(key, wildcard_exclude->key, wildcard_exclude->key_len) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key
is not a null terminated string and this comparison can potentially fail. Since klen
is set, I recommend comparing first klen == wildcard_exclude->key_len
and if it passes then do the strncmp()
Implements #10111 by adding
wildcard_exclude
config tonest
filter#10111
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.