Class: Fluent::UnwindOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::UnwindOutput
- Defined in:
- lib/fluent/plugin/out_unwind.rb
Constant Summary collapse
- REQUIRED_PARAMS =
%w(output_tag unwind_key)
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/fluent/plugin/out_unwind.rb', line 9 def configure(conf) super REQUIRED_PARAMS.each do |param| unless config.has_key?(param) raise Fluent::ConfigError, "#{param} field is required" end end end |
#emit(tag, es, chain) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fluent/plugin/out_unwind.rb', line 18 def emit(tag, es, chain) es.each do |time, record| chain.next if record[unwind_key] && record[unwind_key].is_a?(Array) record[unwind_key].each do |value| new_record = record.dup new_record[unwind_key] = value Fluent::Engine.emit(output_tag, time, new_record) end else Fluent::Engine.emit(output_tag, time, record) end end end |