Class: Fluent::IdobataOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_idobata.rb

Instance Method Summary collapse

Constructor Details

#initializeIdobataOutput

Returns a new instance of IdobataOutput.



10
11
12
# File 'lib/fluent/plugin/out_idobata.rb', line 10

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



18
19
20
21
22
23
# File 'lib/fluent/plugin/out_idobata.rb', line 18

def configure(conf)
  super

  @erb = ERB.new(@message_template)
  @q = Queue.new
end

#emit(tag, es, chain) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fluent/plugin/out_idobata.rb', line 39

def emit(tag, es, chain)
  es.each {|time, record|
    param = OpenStruct.new
    param.tag = tag
    param.time = time
    param.record = record

    @q.push param
  }

  chain.next
end

#shutdownObject



33
34
35
36
37
# File 'lib/fluent/plugin/out_idobata.rb', line 33

def shutdown
  super

  Thread.kill(@thread)
end

#startObject



25
26
27
28
29
30
31
# File 'lib/fluent/plugin/out_idobata.rb', line 25

def start
  super

  @thread = Thread.new(&method(:post))
rescue
  $log.warn "raises exception: #{$!.class}, '#{$!.message}"
end