class Fluent::ResolvOutput

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_resolv.rb, line 10
def configure(conf)
  super
  @remove_prefix = Regexp.new("^#{Regexp.escape(remove_prefix)}\.?") unless conf['remove_prefix'].nil?
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_resolv.rb, line 15
def emit(tag, es, chain)
  tag = tag.sub(@remove_prefix, '') if @remove_prefix
  tag = (@add_prefix + '.' + tag) if @add_prefix
  es.each do |time,record|
    record[@key_name] = Resolv.getname(record[@key_name]) rescue record[@key_name].empty? ? 'n/a' : record[@key_name]
    Fluent::Engine.emit(tag, time, record)
  end
  chain.next
end