class Fluent::KeyPickerOutput

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_key_picker.rb, line 12
def configure(conf)
  super

  if (
      !remove_tag_prefix &&
      !remove_tag_suffix &&
      !add_tag_prefix    &&
      !add_tag_suffix
  )
    raise ConfigError, "out_key_picker: At least one of remove_tag_prefix/remove_tag_suffix/add_tag_prefix/add_tag_suffix is required to be set."
  end

  unless keys && keys.length > 1
    raise ConfigError, "keys: You need to specify the keys you want to pick."
  end

  @keys = keys && keys.split(/\s*,\s*/)
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_key_picker.rb, line 39
def emit(tag, es, chain)
  es.each {|time,record|
    t = tag.dup
    filter_record(t, time, record)
    Engine.emit(t, time, record)
  }
  chain.next
end
filter_record(tag, time, record) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_key_picker.rb, line 48
def filter_record(tag, time, record)
  begin
    record.keep_if{|key, value| @keys.include?(key.to_s)}
  rescue ArgumentError => error
    $log.warn("out_key_picker: #{error.message}")
  end
  super(tag, time, record)
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_key_picker.rb, line 35
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_key_picker.rb, line 31
def start
  super
end