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

#1416

Closed
Closed

Conversation

jitran
Copy link
Contributor

@jitran jitran commented Jan 11, 2017

For multiline events, if the first line doesn't match the prescribed pattern, we should still store the unmatched lines in the line buffer so that plugins such as fluent-plugin-grok-parser can report the log event as a grok parse error, see: fluent/fluent-plugin-grok-parser#25

Example:
input:

abcd efgh
asdfadsasda

output:

{"message":"abcd efgh\nasdfadsasda","grokfailure":"No grok pattern matched","server":"tranj-fluentd-s3b","stack":"my-app-pdev-01","application":"my-app","log_type":"filter.test","time":"2017-01-11T04:19:56Z"}

@repeatedly
Copy link
Member

in_tail tests are broken. It means this patch breaks multiline mode result.
So I'm not sure this is proper patch for multiline_grok.

@repeatedly repeatedly added the moreinfo Missing version, need reproducible steps, need to investigate more label Jan 11, 2017
@jitran
Copy link
Contributor Author

jitran commented Jan 13, 2017

i wonder if the wider fluentd community are interested in being able to capture unmatched multiline events? currently the only way is through the td-agent. In logstash it is stored in the output tagged with grokparsefailure

@jitran jitran force-pushed the add-unmatched-lines-to-line-buffer branch from 019fcb1 to 16be5df Compare January 15, 2017 22:49
@jitran
Copy link
Contributor Author

jitran commented Jan 15, 2017

Hi @repeatedly, I've redone the implementation so that the multiline-logstash behaviour is turned on when enable_multiline_catch_all is set to true. I'm not sure why some of the tests are failing though. Are they existing test failures?

@repeatedly
Copy link
Member

Another idea is adding emit feature for unmatched logs instead of logging here:

log.warn "got incomplete line before first line from #{tail_watcher.path}: #{line.inspect}"

@jitran
Copy link
Contributor Author

jitran commented Jan 17, 2017

I'm not sure if emitting the event from parse_multilines() is the right way to go about it, I rather have them handled in flush_buffer()

Here's another implementation of handling unmatched lines: jitran@86d188f

Essentially all unmatched lines will be placed inside the parse_fail attribute, i.e.

{"parse_fail":"unmatched line....rest of the line","server":"myserver","stack":"my-app-dev-01","application":"my-app","log_type":"apache.access","time":"2017-01-16T23:06:49Z"}

Please let me know which implementation you prefer. Thanks

…pattern, we should still store the unmatched lines in the line buffer so that plugins such as fluent-plugin-grok-parser can report the log event as a grok parse error, see: fluent/fluent-plugin-grok-parser#25. To enable this, set enable_multiline_catch_all to true in the of source section
@jitran jitran force-pushed the add-unmatched-lines-to-line-buffer branch from 16be5df to 42ed42e Compare January 17, 2017 07:24
@jitran
Copy link
Contributor Author

jitran commented Jan 20, 2017

Closing this PR in favour of this #1421

@jitran jitran closed this Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
moreinfo Missing version, need reproducible steps, need to investigate more
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants