From 83f9c8b7aa05b724eaeee115a1681505aaf29323 Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Fri, 16 Aug 2019 12:02:09 +0900 Subject: [PATCH] Not to call Parser#configure is called twice First time is in parser helper https://github.com/fluent/fluentd/blob/5a7d94941371dddcb7150a73ddbe142102a68964/lib/fluent/plugin_helper/parser.rb#L82 Second time is parser_create in TailInput https://github.com/fluent/fluentd/blob/5a7d94941371dddcb7150a73ddbe142102a68964/lib/fluent/plugin/in_tail.rb#L151 Signed-off-by: Yuta Iwama --- lib/fluent/plugin/in_tail.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index e6ecc20b84..727f3bd791 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -97,6 +97,10 @@ def initialize desc 'Ignore repeated permission error logs' config_param :ignore_repeated_permission_error, :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' + end + attr_reader :paths @@pos_file_paths = {} @@ -148,7 +152,8 @@ def configure(conf) method(:parse_singleline) end @file_perm = system_config.file_permission || FILE_PERMISSION - @parser = parser_create(conf: parser_config) + # parser is already created by parser helper + @parser = parser_create(usage: parser_config['usage'] || @parser_configs.first.usage) end def configure_tag