Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def detach_watcher(tw, ino, close_io = true)

tw.close if close_io

if @pf && tw.unwatched && (@follow_inode || !@tails[tw.path])
if @pf && tw.unwatched && (@follow_inodes || !@tails[tw.path])
target_info = TargetInfo.new(tw.path, ino)
@pf.unwatch(target_info)
end
Expand Down Expand Up @@ -751,7 +751,7 @@ def convert_line_to_event(line, es, tail_watcher)
else
if @emit_unmatched_lines
record = {'unmatched_line' => line}
record[@path_key] ||= tail_watcher.path unless @path_key.nil?
record[@path_key] ||= tw.path unless @path_key.nil?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change looks inverted. In convert_line_to_event(line, es, tail_watcher) the parameter is named tail_watcher, and tw is not in scope here (the block parameters are |time, record|). So tw.path raises NameError: undefined local variable or method 'tw' whenever this branch runs (emit_unmatched_lines enabled with path_key).

es.add(Fluent::EventTime.now, record)
end
log.warn { "pattern not matched: #{line.inspect}" }
Expand Down
Loading