diff --git a/lib/fluent/agent.rb b/lib/fluent/agent.rb index 66ccfa50cf..b1f4b43820 100644 --- a/lib/fluent/agent.rb +++ b/lib/fluent/agent.rb @@ -135,7 +135,8 @@ def add_match(type, pattern, conf) output.router = @event_router if output.respond_to?(:router=) output.configure(conf) @outputs << output - if output.respond_to?(:outputs) && (output.is_a?(Fluent::Plugin::MultiOutput) || output.is_a?(Fluent::MultiOutput)) + if output.respond_to?(:outputs) && (output.respond_to?(:multi_output?) && output.multi_output? || output.is_a?(Fluent::MultiOutput)) + # TODO: ruby 2.3 or later: replace `output.respond_to?(:multi_output?) && output.multi_output?` with output&.multi_output? @outputs.push(*output.outputs) end @event_router.add_rule(pattern, output) diff --git a/lib/fluent/plugin/multi_output.rb b/lib/fluent/plugin/multi_output.rb index 51a6ef625c..56fb498948 100644 --- a/lib/fluent/plugin/multi_output.rb +++ b/lib/fluent/plugin/multi_output.rb @@ -53,6 +53,10 @@ def initialize # @rollback_count = 0 end + def multi_output? + true + end + def configure(conf) super