Repository navigation
in_tcp: drop only the line the parser fails on #5640
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -141,7 +141,7 @@ def start | |||||||||||||||||||||||||||||||||||||
| next | ||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @parser.parse(msg) do |time, record| | ||||||||||||||||||||||||||||||||||||||
| parse_message(msg) do |time, record| | ||||||||||||||||||||||||||||||||||||||
| unless time && record | ||||||||||||||||||||||||||||||||||||||
| log.on_warn { warn_pattern_not_matched(msg) } | ||||||||||||||||||||||||||||||||||||||
| next | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -192,7 +192,7 @@ def start | |||||||||||||||||||||||||||||||||||||
| next | ||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @parser.parse(msg) do |time, record| | ||||||||||||||||||||||||||||||||||||||
| parse_message(msg) do |time, record| | ||||||||||||||||||||||||||||||||||||||
| unless time && record | ||||||||||||||||||||||||||||||||||||||
| log.on_warn { warn_pattern_not_matched(msg) } | ||||||||||||||||||||||||||||||||||||||
| next | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -221,6 +221,12 @@ def start | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| private | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def parse_message(msg, &block) | ||||||||||||||||||||||||||||||||||||||
| @parser.parse(msg, &block) | ||||||||||||||||||||||||||||||||||||||
| rescue => e | ||||||||||||||||||||||||||||||||||||||
| log.warn "failed to parse message", error: e, message: msg[...MAX_LOGGED_MESSAGE_LENGTH], size: msg.bytesize | ||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+224
to
+228
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MUST: This rescue also covers the block. So in the single-emit path, it catches errors from The description says emit errors are unaffected because To reproduce, use this config and send Each line after the buffer is full logs this, and the connection stays open: In the batch-emit path, Please rescue only the errors from the parser, and re-raise the errors from the block. One way is to track whether the block is running. This keeps the block running inside
Suggested change
Do not reset Please also add a test for this case. For example, use the single-emit config and stub |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def warn_pattern_not_matched(msg) | ||||||||||||||||||||||||||||||||||||||
| if msg.length > MAX_LOGGED_MESSAGE_LENGTH | ||||||||||||||||||||||||||||||||||||||
| log.warn "pattern not matched", message: msg[...MAX_LOGGED_MESSAGE_LENGTH], size: msg.bytesize | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Could you add
log.debug_backtrace(e.backtrace)after this warn? in_tail does the same for an invalid line (lib/fluent/plugin/in_tail/line_feeder.rb). On master, the server helper logged the backtrace. With this change, it is not logged at any level, so a bug in a third-party parser is hard to locate.