Sha256: 801c1423c30d37349e5155406cb62522e80dc43a4925f9428a5beb9e8f534abc
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
module Fluent class ReemitOutput < Output Fluent::Plugin.register_output('reemit', self) # To support log_level option implemented by Fluentd v0.10.43 unless method_defined?(:log) define_method("log") { $log } end def initialize super @match_cache = {} end def configure(conf) super end def emit(tag, es, chain) engine_emit(tag, es) chain.next rescue => e log.warn "reemit: #{e.class} #{e.message} #{e.backtrace.first}" end # My Engine.emit def engine_emit(tag, es) target = @match_cache[tag] unless target target = engine_match(tag) || Fluent::EngineClass::NoMatchMatch.new @match_cache[tag] = target end target.emit(tag, es) end # My Engine.match def engine_match(tag) # @matches.find {|m| m.match(tag) } # original Engine.match Engine.matches.find {|m| match_without_self(m, tag) } end # <match foo.bar> # type reemit # </match> # # and # # <match foo.bar> # type copy # <store> # type reemit # </store> # </match> def match_without_self(m, tag) return false if contain_self?(m.output) m.match(tag) end def contain_self?(output) if output.kind_of?(MultiOutput) output.outputs.each do |o| return true if contain_self?(o) end else return true if output == self end false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-reemit-0.0.5 | lib/fluent/plugin/out_reemit.rb |
fluent-plugin-reemit-0.0.4 | lib/fluent/plugin/out_reemit.rb |