Skip to content
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

multiline: cri: Use non-greedy parsing for parsing time #5078

Merged
merged 1 commit into from
Apr 3, 2022
Merged

multiline: cri: Use non-greedy parsing for parsing time #5078

merged 1 commit into from
Apr 3, 2022

Conversation

danlenar
Copy link
Contributor

@danlenar danlenar commented Mar 14, 2022

Fixes #4377 and #5010

If a pod logs in cri format, you potentially have fluent-bit parsing this

<time> <stream> <_p> <log_a>
where log_a is also in cri format
<time> <stream> <_p> <log_b>

This causes time regex to be greedy and you run into issues of invalid time format and time string length is too long.

This also causes fluent-bit to go into an infinite loop of rejecting its own logs

./fluent-bit-containerd-7dfm9_logging_fluent-bit-7faa06256bcf2ec5b526ce780d77c60f1fe10e92649679891ecb9c5b3f1f8efc.log:2022-03-14T16:24:20.770455995-06:00 stderr F [2022/03/14 22:24:20] [ warn] [parser:_ml_cri] invalid time format %Y-%m-%dT%H:%M:%S.%L%z for '2022-03-14T16:24:18.778252457-06:00 stderr F [2022/03/14 22:24:18] [ warn] [parser:_ml_cri] invalid time format %Y-%m-%dT%H:%M:%S.%L%z for '2022-03-14T16:24:16.798195119-06:00'

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 found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • Backport to latest stable release.

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.

Signed-off-by: Daniel Lenar <dlenar@vailsys.com>
Copy link
Collaborator

@leonardo-albertovich leonardo-albertovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what's better from both a performance and clarity point of view, a non greedy "dot" or a character set that excludes spaces.

I think this is fine regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop for time string length is too long
4 participants