Class: Fluent::RubyOneLinerOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::RubyOneLinerOutput
- Defined in:
- lib/fluent/plugin/out_ruby_one_liner.rb
Instance Method Summary collapse
- #configure(config) ⇒ Object
- #emit(tag, es, chain) ⇒ Object
-
#initialize ⇒ RubyOneLinerOutput
constructor
A new instance of RubyOneLinerOutput.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ RubyOneLinerOutput
Returns a new instance of RubyOneLinerOutput.
9 10 11 |
# File 'lib/fluent/plugin/out_ruby_one_liner.rb', line 9 def initialize super end |
Instance Method Details
#configure(config) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fluent/plugin/out_ruby_one_liner.rb', line 13 def configure(config) super libs = @require_libs.split(',') libs.each {|lib| require lib} @config = config @lambda = eval("lambda {|tag, time, record| #{@command}}") @q = Queue.new end |
#emit(tag, es, chain) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fluent/plugin/out_ruby_one_liner.rb', line 38 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 |
#shutdown ⇒ Object
32 33 34 35 36 |
# File 'lib/fluent/plugin/out_ruby_one_liner.rb', line 32 def shutdown super Thread.kill(@thread) end |
#start ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/out_ruby_one_liner.rb', line 24 def start super @thread = Thread.new(&method(:run)) rescue $log.warn "raises exception: #{$!.class}, '#{$!.}" end |