diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 65d5774d59..326487675c 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -28,6 +28,7 @@ def initialize super @paths = [] @tails = {} + @ignore_list = [] end desc 'The paths to read. Multiple paths can be specified, separated by comma.' @@ -62,6 +63,8 @@ def initialize config_param :limit_recently_modified, :time, default: nil desc 'Enable the option to skip the refresh of watching list on startup.' config_param :skip_refresh_on_startup, :bool, default: false + desc 'Ignore repeated permission error logs' + config_param :ignore_repeated_permission_error, :bool, default: false attr_reader :paths @@ -166,7 +169,10 @@ def expand_paths end else if is_file - log.warn "#{p} unreadable. It is excluded and would be examined next time." + unless @ignore_list.include?(path) + log.warn "#{p} unreadable. It is excluded and would be examined next time." + @ignore_list << path if @ignore_repeated_permission_error + end end false end diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index 3ff841acee..ceb0a80b57 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -50,6 +50,7 @@ def test_configure assert_equal 2, d.instance.rotate_wait assert_equal "#{TMP_DIR}/tail.pos", d.instance.pos_file assert_equal 1000, d.instance.read_lines_limit + assert_equal false, d.instance.ignore_repeated_permission_error end def test_configure_encoding