From bd02bea8608973c72ad85ab08bf6f62cf4a1d572 Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Fri, 25 Oct 2019 11:20:23 +0900 Subject: [PATCH 01/14] Supervisor print gem list instead of worker0 Signed-off-by: Yuta Iwama --- lib/fluent/engine.rb | 5 ----- lib/fluent/supervisor.rb | 11 +++++++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/fluent/engine.rb b/lib/fluent/engine.rb index aa18ac7d57..b9af3e67e9 100644 --- a/lib/fluent/engine.rb +++ b/lib/fluent/engine.rb @@ -113,11 +113,6 @@ def run_configure(conf) end def configure(conf) - # plugins / configuration dumps - Gem::Specification.find_all.select{|x| x.name =~ /^fluent(d|-(plugin|mixin)-.*)$/}.each do |spec| - $log.info :worker0, "gem '#{spec.name}' version '#{spec.version}'" - end - @root_agent.configure(conf) begin diff --git a/lib/fluent/supervisor.rb b/lib/fluent/supervisor.rb index 36f26dffcf..38f20a5511 100644 --- a/lib/fluent/supervisor.rb +++ b/lib/fluent/supervisor.rb @@ -586,7 +586,7 @@ def dry_run Fluent::Engine.dry_run_mode = true change_privilege MessagePackFactory.init - init_engine + init_engine(supervisor: true) run_configure rescue Fluent::ConfigError => e $log.error "config error", file: @config_path, error: e @@ -794,7 +794,7 @@ def change_privilege ServerEngine::Privilege.change(@chuser, @chgroup) end - def init_engine + def init_engine(supervisor: false) Fluent::Engine.init(@system_config) @libs.each {|lib| @@ -807,6 +807,13 @@ def init_engine Fluent::Engine.add_plugin_dir(dir) end } + + if supervisor + # plugins / configuration dumps + Gem::Specification.find_all.select { |x| x.name =~ /^fluent(d|-(plugin|mixin)-.*)$/ }.each do |spec| + $log.info("gem '#{spec.name}' version '#{spec.version}'") + end + end end def run_configure From d44ce3ba0ab73b569993685c637f1ad95e9085dd Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Fri, 25 Oct 2019 12:02:46 +0900 Subject: [PATCH 02/14] if `@log_event_router` exists, log is already enabled https://github.com/fluent/fluentd/blob/fcd467c722c491919c7044c772e9e49ead3ef787/lib/fluent/engine.rb#L151 Signed-off-by: Yuta Iwama --- lib/fluent/engine.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/fluent/engine.rb b/lib/fluent/engine.rb index b9af3e67e9..5ffa24d358 100644 --- a/lib/fluent/engine.rb +++ b/lib/fluent/engine.rb @@ -204,7 +204,6 @@ def run start if @log_event_router - $log.enable_event(true) @log_emit_thread = Thread.new(&method(:log_event_loop)) @log_emit_thread.abort_on_exception = true end From 3a3aee0227b621b61d1d7f258147f7ff661316e0 Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Fri, 25 Oct 2019 12:13:05 +0900 Subject: [PATCH 03/14] Add FluentLogEventEmitter Signed-off-by: Yuta Iwama --- lib/fluent/engine.rb | 72 +++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/lib/fluent/engine.rb b/lib/fluent/engine.rb index 5ffa24d358..7c656f9692 100644 --- a/lib/fluent/engine.rb +++ b/lib/fluent/engine.rb @@ -115,36 +115,12 @@ def run_configure(conf) def configure(conf) @root_agent.configure(conf) - begin - log_event_agent = @root_agent.find_label(Fluent::Log::LOG_EVENT_LABEL) - log_event_router = log_event_agent.event_router - - # suppress mismatched tags only for