Sha256: 819a9b0ebd4a0997df9d9bcd842b4f6ba3e74013762cbf1c2b12a0f60bc88b35
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'fluent/output' module Fluent class CopyExOutput < MultiOutput Plugin.register_output('copy_ex', self) config_param :deep_copy, :bool, :default => false def initialize super @outputs = [] @ignore_errors = [] end attr_reader :outputs, :ignore_errors def configure(conf) super conf.elements.select {|e| e.name == 'store' }.each {|e| type = e['@type'] || e['type'] unless type raise ConfigError, "Missing '@type' parameter on <store> directive" end log.debug "adding store type=#{type.dump}" output = Plugin.new_output(type) output.configure(e) @outputs << output @ignore_errors << (e.arg == "ignore_error") } end def start @outputs.each {|o| o.start } end def shutdown @outputs.each {|o| o.shutdown } end def emit(tag, es, chain) unless es.repeatable? m = MultiEventStream.new es.each {|time,record| m.add(time, record) } es = m end # Here, we do not use OutputChain for custom @outputs.each_index do |idx| _es = @deep_copy ? es.dup : es begin @outputs[idx].emit(tag, _es, NullOutputChain.instance) rescue => e if @ignore_errors[idx] log.error :error_class => e.class, :error => e.message else raise e end end end chain.next end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-copy_ex-0.0.2 | lib/fluent/plugin/out_copy_ex.rb |