From 44a9dde375057c236ff2222596a129b070f8a44f Mon Sep 17 00:00:00 2001 From: "GOOGLE\\talarico" Date: Wed, 12 Apr 2017 11:24:22 -0700 Subject: [PATCH 1/3] Do not warn on directories. Currently a warning will appear for directories that are globbed. They will never be reabable so the message appears on each refresh. --- lib/fluent/plugin/in_tail.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 9863296d6f..77191ec0c8 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -189,14 +189,17 @@ def expand_paths path = date.strftime(path) if path.include?('*') paths += Dir.glob(path).select { |p| - if File.readable?(p) && !File.directory?(p) + is_directory = File.directory?(p) + if File.readable?(p) && !is_directory if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified) false else true end else - log.warn "#{p} unreadable. It is excluded and would be examined next time." + if !is_directory + log.warn "#{p} unreadable. It is excluded and would be examined next time." + end false end } From e44da507507aa8f450fc38e76de397b0e64efe40 Mon Sep 17 00:00:00 2001 From: "GOOGLE\\talarico" Date: Wed, 12 Apr 2017 11:49:52 -0700 Subject: [PATCH 2/3] Fix tabs --- lib/fluent/plugin/in_tail.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 77191ec0c8..9ca422279b 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -189,7 +189,7 @@ def expand_paths path = date.strftime(path) if path.include?('*') paths += Dir.glob(path).select { |p| - is_directory = File.directory?(p) + is_directory = File.directory?(p) if File.readable?(p) && !is_directory if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified) false @@ -197,9 +197,9 @@ def expand_paths true end else - if !is_directory + if !is_directory log.warn "#{p} unreadable. It is excluded and would be examined next time." - end + end false end } From a01a7e26fa7a52980975bee280cf149153055b0b Mon Sep 17 00:00:00 2001 From: "GOOGLE\\talarico" Date: Wed, 12 Apr 2017 13:06:13 -0700 Subject: [PATCH 3/3] use is_file in place if !is_directory --- lib/fluent/plugin/in_tail.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 9ca422279b..2e75abb660 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -189,15 +189,15 @@ def expand_paths path = date.strftime(path) if path.include?('*') paths += Dir.glob(path).select { |p| - is_directory = File.directory?(p) - if File.readable?(p) && !is_directory + is_file = !File.directory?(p) + if File.readable?(p) && is_file if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified) false else true end else - if !is_directory + if is_file log.warn "#{p} unreadable. It is excluded and would be examined next time." end false