class Fluent::AddEmptyArrayOutput

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_add_empty_array.rb, line 8
def initialize
  super
end

Public Instance Methods

add_empty_array(record) click to toggle source
# File lib/fluent/plugin/out_add_empty_array.rb, line 51
def add_empty_array(record)
  @array_type_key.each do |key|
    record[key] = [] unless record.has_key?(key)
  end
  return record
rescue => e
  log.warn("out_add_empty_array: error_class:#{e.class} error_message:#{e.message} tag:#{tag} record:#{record} bactrace:#{e.backtrace.first}")
end
configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_add_empty_array.rb, line 17
def configure(conf)
  super

  if @array_type_key
    @array_type_key = @array_type_key.split(@delimiter)
  end

  unless @array_type_key
    raise ConfigError, "'array_type_key' parameter is required on 'fluent-plugin-add_empty_array'"
  end
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_add_empty_array.rb, line 37
def emit(tag, es, chain)
  es.each {|time, record|
    t = tag.dup
    new_record = add_empty_array(record)

    t = @tag_prefix + t unless @tag_prefix.nil?

    Engine.emit(t, time, new_record)
  }
  chain.next
rescue => e
  log.warn("out_add_empty_array: error_class:#{e.class} error_message:#{e.message} tag:#{tag} es:#{es} record:#{record} bactrace:#{e.backtrace.first}")
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_add_empty_array.rb, line 33
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_add_empty_array.rb, line 29
def start
  super
end