-
Notifications
You must be signed in to change notification settings - Fork 1.7k
filter_grep: respect all rules even when a match is found #3345
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
base: master
Are you sure you want to change the base?
Conversation
Currently the filter will keep data when the first positive match for a rule is found, regardless of whether the data would be excluded by another rule later on. This leads to surprising behaviour when combining Regex rules with one another or when combining Regex rules with Exclude rules: * The order of Regex rules matters, but the order of Exclude rules does not. * Mixing Regex and Exclude rules will result in the Exclude rules being ignored if *any* of the Regex rules match. This commit changes the existing behaviour so that inputs must pass *all* rules. It includes runtime tests for this behaviour. This is a **breaking change** for users with multiple Regex rules in a single block that rely on the existing short-circuiting behaviour. Fixes fluent#3259. Signed-off-by: Aaron Jacobs <[email protected]>
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Not stale, still fixes an active issue. |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Still an active issue. |
@atheriel Thank you for contribution and sorry for late reply. Can you add a configuration parameter to select current/this behavior ? I prefer the default is current behavior to prevent breaking change. |
@nokute78 I'm happy to add a configuration value if needed, but I'm not sure I understand your comment:
Do you want this to be the default or not? I'd prefer to avoid implementing the configuration option if it will not be used. |
@atheriel
This PR is to support 1. |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Currently the
grep
filter will keep data when the first positive match for a rule is found, regardless of whether the data would be excluded by another rule later on. An example is given in #3259.This leads to surprising behaviour when combining
Regex
rules with one another or when combiningRegex
rules withExclude
rules:The order of
Regex
rules matters, but the order ofExclude
rules does not.Mixing
Regex
andExclude
rules will result in theExclude
rules being ignored if any of theRegex
rules match.This commit changes the existing behaviour so that inputs must pass all rules.
I've also included new runtime tests for this behaviour.
This is a breaking change for users with multiple
Regex
rules in a single block that rely on the existing short-circuiting behaviour. However, I think the new behaviour is consistent with the existing documentation, so I'm not sure why anyone would be doing this.Fixes #3259.
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:
[N/A]
Example configuration file for the change[N/A]
Debug log output from testing the change[N/A]
Attached Valgrind output that shows no leaks or memory corruption was foundDocumentation
[N/A]
Documentation required for this featureFluent 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.