From 527f53cc1f15b2b0c6301070c4c20f6dc9386636 Mon Sep 17 00:00:00 2001 From: Manus Freedom Date: Mon, 1 Jun 2015 18:07:32 +0200 Subject: [PATCH] - Add follow_only_path option https://github.com/manusfreedom/ruby-filewatch/commit/92e660f0801c3ce4b8b53d93a7f6a988b96354c7 --- lib/logstash/inputs/file.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/logstash/inputs/file.rb b/lib/logstash/inputs/file.rb index a636004..99aafde 100644 --- a/lib/logstash/inputs/file.rb +++ b/lib/logstash/inputs/file.rb @@ -65,6 +65,12 @@ class LogStash::Inputs::File < LogStash::Inputs::Base # has no effect. config :start_position, :validate => [ "beginning", "end"], :default => "end" + # In cases where files are rsynced to the consuming server, inodes will change when + # updated files overwrite original ones, resulting in inode changes. In order to + # avoid having the sincedb.member check from failing in this scenario, we'll + # construct the inode key using the path which will be 'stable' + config :follow_only_path, :validate => :boolean, :default => false + # set the new line delimiter, defaults to "\n" config :delimiter, :validate => :string, :default => "\n" @@ -121,6 +127,7 @@ def register end @tail_config[:sincedb_path] = @sincedb_path + @tail_config[:follow_only_path] = @follow_only_path if @start_position == "beginning" @tail_config[:start_new_files_at] = :beginning