Class: Fluent::ConfigPitOutput

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pluginObject

Returns the value of attribute plugin.



4
5
6
# File 'lib/fluent/plugin/out_config_pit.rb', line 4

def plugin
  @plugin
end

Instance Method Details

#configure(conf) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fluent/plugin/out_config_pit.rb', line 13

def configure(conf)
  super

  configs = conf.elements.select {|e| e.name == 'pit' }
  if configs.size != 1
    raise Fluent::ConfigError, "config_pit needs just one <pit ...> ... </pit> section"
  end

  Fluent::Config::Pit.extract(configs.first).tap do |c|
    @plugin = Fluent::Plugin.new_output(c['type'])
    @plugin.configure(c)
  end

  mark_used(configs.first)
end

#emit(tag, es, chain) ⇒ Object



37
38
39
# File 'lib/fluent/plugin/out_config_pit.rb', line 37

def emit(tag, es, chain)
  @plugin.emit(tag, es, chain)
end

#mark_used(conf) ⇒ Object



8
9
10
11
# File 'lib/fluent/plugin/out_config_pit.rb', line 8

def mark_used(conf)
  conf.used = conf.keys
  conf.elements.each{|e| mark_used(e)}
end

#shutdownObject



33
34
35
# File 'lib/fluent/plugin/out_config_pit.rb', line 33

def shutdown
  @plugin.shutdown
end

#startObject



29
30
31
# File 'lib/fluent/plugin/out_config_pit.rb', line 29

def start
  @plugin.start
end