From 53c5df9e4e471722d03e8231462d7877e5cf0484 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Thu, 22 Jun 2023 22:04:11 +0900 Subject: [PATCH] in_tail: Fix warning about overwriting entry with follow_inodes Signed-off-by: Daijiro Fukuda --- lib/fluent/plugin/in_tail/position_file.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/fluent/plugin/in_tail/position_file.rb b/lib/fluent/plugin/in_tail/position_file.rb index ad1cb3ef11..2d58da9e0e 100644 --- a/lib/fluent/plugin/in_tail/position_file.rb +++ b/lib/fluent/plugin/in_tail/position_file.rb @@ -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