Skip to content

Commit

Permalink
Merge pull request #4214 from daipom/in_tail-fix-warning-overwriting-…
Browse files Browse the repository at this point in the history
…entry-with-follow_inodes

in_tail: Fix warning log about overwriting entry with follow_inodes
  • Loading branch information
ashie authored Jun 23, 2023
2 parents 02ae0ae + 53c5df9 commit b71ab13
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 b71ab13

Please sign in to comment.