-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Capture unmatched lines #1421
Capture unmatched lines #1421
Changes from 2 commits
49ff636
aba4b73
eba4c61
d874db1
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 |
---|---|---|
|
@@ -65,6 +65,8 @@ def initialize | |
config_param :read_lines_limit, :integer, default: 1000 | ||
desc 'The interval of flushing the buffer for multiline format' | ||
config_param :multiline_flush_interval, :time, default: nil | ||
desc 'Enable the option to capture unmatched lines.' | ||
config_param :enable_catch_all, :bool, default: false | ||
desc 'Enable the additional watch timer.' | ||
config_param :enable_watch_timer, :bool, default: true | ||
desc 'The encoding after conversion of the input.' | ||
|
@@ -357,6 +359,11 @@ def convert_line_to_event(line, es, tail_watcher) | |
record[@path_key] ||= tail_watcher.path unless @path_key.nil? | ||
es.add(time, record) | ||
else | ||
if @enable_catch_all | ||
record = {'parse_fail' => line} | ||
record[@path_key] ||= tail_watcher.path unless @path_key.nil? | ||
es.add(Time.now.to_i, record) | ||
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. Use 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. We're using the Redhat version of td-agent which comes with Fluentd v0.12. Do you know when the 0.14 branch will be stable? If it's still quite long away, should I merge my branch into the 0.12 branch instead? 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. If you want this feature in v0.12, you also need to send a patch to v0.12 branch. 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. Still |
||
end | ||
log.warn "pattern not match: #{line.inspect}" | ||
end | ||
} | ||
|
@@ -387,6 +394,9 @@ def parse_multilines(lines, tail_watcher) | |
lb = line | ||
else | ||
if lb.nil? | ||
if @enable_catch_all | ||
convert_line_to_event(line, es, tail_watcher) | ||
end | ||
log.warn "got incomplete line before first line from #{tail_watcher.path}: #{line.inspect}" | ||
else | ||
lb << line | ||
|
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.
emit_unmatched_lines
oremit_parse_failed_lines
is more better.enable_catch_all
is unclear name for me.