-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"match regular expression" stream rule type fails to properly validate message starting with a blank space #1936
Comments
This is related to message fields being trimmed in the Seems to be introduced in 152e901 due to #186, unfortunately without any given context/reason. |
This was introduced because people struggled with "invisible" whitespaces at the beginning or more importantly end of the string. We decided to trim them off and let people use the The UI should be consistent with this of course or as a workaround be able to alert that there are whitespaces. I'd vote for not changing the existing backend behaviour because this can lead to hard to debug side effects when upgrading and stream rules are suddenly no longer matching. |
If we do not want to change the backend behavior, we have no way to fix this issue, as the frontend simply does not know that certain fields are trimmed. We could look into moving the trimming to the stream rule matchers (or to be safe: match a stream rule both against the trimmed and non-trimmed field if it matches against the start of the string), although I think correcting a bug which causes an inconsistency between predicted and actual matching results justifies a breaking change, as long as it is documented properly. |
Before this change, one of the public constructors of `Message` was using `addField()` to add fields in the `Message` object, while the other was adding the fields by hand to the internal `Map` used to store message fields. That created an inconsistency, as the constructor using `addField()` trims all `String` field values by default, unlike the other constructor. You can read more about it in: #1936. This commit ensures both constructors trim `String` values, while still ensuring `Message(final String message, final String source, final DateTime timestamp)` will create a `Message` object containing the required fields given as arguments. Making this change will break stream rules checking for one or more leading or trailing whitespaces in message fields. Fixes #1936
Before this change, one of the public constructors of `Message` was using `addField()` to add fields in the `Message` object, while the other was adding the fields by hand to the internal `Map` used to store message fields. That created an inconsistency, as the constructor using `addField()` trims all `String` field values by default, unlike the other constructor. You can read more about it in: #1936. This commit ensures both constructors trim `String` values, while still ensuring `Message(final String message, final String source, final DateTime timestamp)` will create a `Message` object containing the required fields given as arguments. Making this change will break stream rules, extractors, and drool rules checking for one or more leading or trailing whitespaces in message fields. Fixes #1936
Before this change, one of the public constructors of `Message` was using `addField()` to add fields in the `Message` object, while the other was adding the fields by hand to the internal `Map` used to store message fields. That created an inconsistency, as the constructor using `addField()` trims all `String` field values by default, unlike the other constructor. You can read more about it in: #1936. This commit ensures both constructors trim `String` values, while still ensuring `Message(final String message, final String source, final DateTime timestamp)` will create a `Message` object containing the required fields given as arguments. Making this change will break stream rules, extractors, and drool rules checking for one or more leading or trailing whitespaces in message fields. Fixes #1936
Before this change, one of the public constructors of `Message` was using `addField()` to add fields in the `Message` object, while the other was adding the fields by hand to the internal `Map` used to store message fields. That created an inconsistency, as the constructor using `addField()` trims all `String` field values by default, unlike the other constructor. You can read more about it in: #1936. This commit ensures both constructors trim `String` values, while still ensuring `Message(final String message, final String source, final DateTime timestamp)` will create a `Message` object containing the required fields given as arguments. Making this change will break stream rules, extractors, and drool rules checking for one or more leading or trailing whitespace in message fields. Fixes #1936
Problem description
Whe you want to match the beginning of a syslog message that starts with a blank space against a "match regular expression" stream rule, you must not include the leading blank space in your regular expression if you want the UI to tell you the message will match. Though, you must include it if you want the StreamMatcherFilter to effectively route your message to your stream.
Steps to reproduce the problem
Sample data
Here are sample data to reproduce the problem:
Message
Rules
Environment
IRC Logs
The text was updated successfully, but these errors were encountered: