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
key_value ignoring whitespace #4920
Comments
Hello, I'm trying to simulate the bug and noticed another bug. Using the message in your example: "email: rob@email.com, event: user login, time: 2018-07-18T08:02:19Z, user_id: 12345" Not only the timestamp gets truncated in the first occurrence of the colon inside the timestamp but also the event gets truncated in the space character, so the event gets mapped to just "user" and the "login" gets lost. |
Continuing with this, the problem resides in the class: Graylog is using CharMatcher from Guava library, that is specially built to work with single characters, not strings. |
another approach would be to fix current behaviour to only apply the inner splitter on the first occurrence of the kv_delimiter char, so next occurrences inside the value string would not be treated. This way it can still working with the CharMatcher. So, how should I try to fix it? |
I decided to just fix the behaviour using CharMatcher, after this fix, setting the kv_delimiter to ":" (without the space) will work as expected |
Prevent splitting values if delimiter chars are found inside values Fixes Graylog2/graylog2-server#4920 (cherry picked from Graylog2/graylog2-server@cfcb622ce in Graylog2/graylog2-server#4927)
@robp1234 Did you perhaps had |
I was directed here from the community forum, as this behaviour appears to be a bug (https://community.graylog.org/t/alert-processing-query/5964).
I have a set of data with key value pairs separated by a colon and a whitespace ": ". The whitespace is being ignored, resulting in data being split on a colon. This breaks the data, as it contains timestamps (e.g. 12:34:34).
Expected Behaviour
I have a data set coming into graylog, into a pipeline and then using a rule to extract the field names and data values.
email: rob@email.com, event: user login, time: 2018-07-18T08:02:19Z, user_id: 12345
My processing rule looks like this:
This breaks, as it splits on the timestamp. I changed kv_delimiters to this:
kv_delimiters: ": "
This includes the whitespace, but the behaviour does not change. The split is done exclusively on the colon, breaking timestamps
I tried escaping the whitespace with \ but that results in an error.
Context
The separator is always a ": " but : can occur in a data field, as can whitespace. Being able to split on ": " would be extremely useful.
This is Graylog 2.4.5.
thanks
Rob
The text was updated successfully, but these errors were encountered: