class Fluent::UnwindOutput

Constants

REQUIRED_PARAMS

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# 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) click to toggle source
# 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