class Fluent::Plugin::CopyOutput

Attributes

ignore_errors[R]

Public Class Methods

new() click to toggle source
Calls superclass method Fluent::Plugin::MultiOutput.new
# File lib/fluent/plugin/out_copy.rb, line 30
def initialize
  super
  @ignore_errors = []
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method Fluent::Plugin::MultiOutput#configure
# File lib/fluent/plugin/out_copy.rb, line 35
def configure(conf)
  super

  @stores.each { |store|
    @ignore_errors << (store.arg == 'ignore_error')
  }
end
multi_workers_ready?() click to toggle source
# File lib/fluent/plugin/out_copy.rb, line 43
def multi_workers_ready?
  true
end
process(tag, es) click to toggle source
# File lib/fluent/plugin/out_copy.rb, line 47
def process(tag, es)
  unless es.repeatable?
    m = Fluent::MultiEventStream.new
    es.each {|time,record|
      m.add(time, record)
    }
    es = m
  end

  outputs.each_with_index do |output, i|
    begin
      output.emit_events(tag, @deep_copy ? es.dup : es)
    rescue => e
      if @ignore_errors[i]
        log.error "ignore emit error", error: e
      else
        raise e
      end
    end
  end
end