Repository navigation
Conversation
Signed-off-by: Preet Mehta <preetmehta1995@gmail.com>
Signed-off-by: Preet Mehta <preetmehta1995@gmail.com>
Signed-off-by: Preet Mehta <preetmehta1995@gmail.com>
Contributor
|
@ynpreet Could you update the description to follow our PR template? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3501
When
emit_unmatched_linesis enabled,in_syslogemits unmatchedlines as
{"unmatched_line": "<line>"}(plus source keys), but givesthe receiver no indication of why the line was unmatched. The cause
only exists in the Fluentd log (
invalid syslog message/failed to parse message/invalid input), which the downstreampipeline cannot see.
This change threads a reason through
emit_unmatchedso the emittedrecord carries it:
unmatched_reason: "invalid syslog message"unmatched_reason: "failed to parse message"unmatched_reason: "invalid input (<Class>: <message>)"The new argument is optional (
reason = nil), so existing callers andthe record shape without a reason are unchanged, the emitted tag
(
${tag}.unmatched) is unchanged, and the existing log lines areunchanged.
Tests
test/plugin/test_in_syslog.rbto assertunmatched_reasonfor theparser-failure path, and added two new tests: one for the
invalid-syslog path (with_priority false, '...' PRI miss) and
one for the exception path (unparseable timestamp raising
TimeParseError).
bundle exec ruby -Itest test/plugin/test_in_syslog.rb=> 51 tests, 311 assertions, 0 failures, 0 errors, 100% passed.
(Ruby 3.2.3 locally; the gemspec version floor was relaxed in the
local clone ONLY for testing and is NOT part of this PR.)