Skip to content

Commit

Permalink
Merge pull request #1574 from fluent/tail-ignore-repeated-permission-…
Browse files Browse the repository at this point in the history
…error

Add ignore_repeated_permission_error
  • Loading branch information
repeatedly committed May 24, 2017
1 parent 282a6b1 commit 0f98f39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f98f39

Please sign in to comment.