Class: Fluent::ConfigExpanderInput
- Inherits:
-
Input
- Object
- Input
- Fluent::ConfigExpanderInput
- Defined in:
- lib/fluent/plugin/in_config_expander.rb
Instance Attribute Summary collapse
-
#plugin ⇒ Object
Returns the value of attribute plugin.
Instance Method Summary collapse
- #builtin_mapping ⇒ Object
- #configure(conf) ⇒ Object
- #expand_config(conf) ⇒ Object
- #mark_used(conf) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Instance Attribute Details
#plugin ⇒ Object
Returns the value of attribute plugin.
12 13 14 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 12 def plugin @plugin end |
Instance Method Details
#builtin_mapping ⇒ Object
19 20 21 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 19 def builtin_mapping {'__hostname__' => @hostname, '__HOSTNAME__' => @hostname, '${hostname}' => @hostname, '${HOSTNAME}' => @hostname} end |
#configure(conf) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 30 def configure(conf) super configs = conf.elements.select{|e| e.name == 'config'} if configs.size != 1 raise Fluent::ConfigError, "config_expander needs just one <config> ... </config> section" end ex = (configs.first) @plugin = Fluent::Plugin.new_input(ex['type']) @plugin.configure(ex) mark_used(configs.first) end |
#expand_config(conf) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 23 def (conf) ex = Fluent::Config::Expander.(conf, builtin_mapping()) ex.name = '' ex.arg = '' ex end |
#mark_used(conf) ⇒ Object
14 15 16 17 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 14 def mark_used(conf) conf.keys.each {|key| conf[key] } # to suppress unread configuration warning conf.elements.each{|e| mark_used(e)} end |
#shutdown ⇒ Object
48 49 50 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 48 def shutdown @plugin.shutdown end |
#start ⇒ Object
44 45 46 |
# File 'lib/fluent/plugin/in_config_expander.rb', line 44 def start @plugin.start end |