Skip to content

Commit

Permalink
in_tail: Fix warning about overwriting entry with follow_inodes
Browse files Browse the repository at this point in the history
Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Jun 22, 2023
1 parent 02ae0ae commit 53c5df9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/fluent/plugin/in_tail/position_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,11 @@ def fetch_compacted_entries(existing_targets = nil)
if pos == UNWATCHED_POSITION
@logger.debug "Remove unwatched line from pos_file: #{line}" if @logger
else
if entries.include?(path)
@logger.warn("#{path} already exists. use latest one: deleted #{entries[path]}") if @logger
end

if @follow_inodes
@logger&.warn("#{path} (inode: #{ino}) already exists. use latest one: deleted #{entries[ino]}") if entries.include?(ino)
entries[ino] = Entry.new(path, pos, ino, file_pos + path.bytesize + 1)
else
@logger&.warn("#{path} already exists. use latest one: deleted #{entries[path]}") if entries.include?(path)
entries[path] = Entry.new(path, pos, ino, file_pos + path.bytesize + 1)
end
file_pos += line.size
Expand Down

0 comments on commit 53c5df9

Please sign in to comment.