Class: Fluent::Plugin::CopyExOutput

Inherits:
CopyOutput
  • Object
show all
Defined in:
lib/fluent/plugin/out_copy_ex/v14.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCopyExOutput

Returns a new instance of CopyExOutput.



9
10
11
12
# File 'lib/fluent/plugin/out_copy_ex/v14.rb', line 9

def initialize
  super
  @ignore_errors = []
end

Instance Attribute Details

#ignore_errorsObject (readonly)

Returns the value of attribute ignore_errors.



7
8
9
# File 'lib/fluent/plugin/out_copy_ex/v14.rb', line 7

def ignore_errors
  @ignore_errors
end

Instance Method Details

#configure(conf) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/fluent/plugin/out_copy_ex/v14.rb', line 14

def configure(conf)
  super

  conf.elements.select {|e|
    e.name == 'store'
  }.each {|e|
    @ignore_errors << (e.arg == "ignore_error")
  }
end

#process(tag, es) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fluent/plugin/out_copy_ex/v14.rb', line 24

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, idx|
    begin
      output.emit_events(tag, @deep_copy ? es.dup : es)
    rescue => e
      if @ignore_errors[idx]
        log.error :error_class => e.class, :error => e.message
      else
        raise e
      end
    end
  end
end