From 78e8cc7a460f6b435f75cf02129d5e9a43f4bed4 Mon Sep 17 00:00:00 2001 From: Artur Piotr Izaak Laskowski Date: Tue, 12 Dec 2023 00:46:07 +0100 Subject: [PATCH 1/2] Add parameter to skip ignoring files In our use-case we have a race condition. We are creating files, then we are setting up privileges. In function 'extend_paths' we can see that if file is not readable once it is ignored, so it happened to us, that some logs were ignored forever. I think that introducing such parameter should be the easiest way to avoid similar problems in the future. Signed-off-by: Artur Laskowski --- lib/fluent/plugin/in_tail.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 44761b4061..44b5b039fa 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -113,6 +113,8 @@ def initialize config_param :follow_inodes, :bool, default: false desc 'Maximum length of line. The longer line is just skipped.' config_param :max_line_size, :size, default: nil + desc 'Skip ignoring files.' + config_param :skip_ignoring_files, :bool, defaults: false config_section :parse, required: false, multi: true, init: true, param_name: :parser_configs do config_argument :usage, :string, default: 'in_tail_parser' @@ -303,7 +305,7 @@ def expand_paths true end else - if is_file + if is_file && !skip_ignoring_files? unless @ignore_list.include?(p) log.warn "#{p} unreadable. It is excluded and would be examined next time." @ignore_list << p if @ignore_repeated_permission_error From 1ee6461d02e5597756b69d0f82ccdc18714be83b Mon Sep 17 00:00:00 2001 From: Artur Laskowski Date: Wed, 13 Dec 2023 20:34:42 +0000 Subject: [PATCH 2/2] Misspeled defaults fixed Signed-off-by: Artur Laskowski --- lib/fluent/plugin/in_tail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index 44b5b039fa..bd07104c51 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -114,7 +114,7 @@ def initialize desc 'Maximum length of line. The longer line is just skipped.' config_param :max_line_size, :size, default: nil desc 'Skip ignoring files.' - config_param :skip_ignoring_files, :bool, defaults: false + config_param :skip_ignoring_files, :bool, default: false config_section :parse, required: false, multi: true, init: true, param_name: :parser_configs do config_argument :usage, :string, default: 'in_tail_parser'