class Fluent::ResolvFilter

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_resolv.rb, line 13
def configure(conf)
  super
  @remove_prefix = Regexp.new("^#{Regexp.escape(remove_prefix)}\.?") unless conf['remove_prefix'].nil?
  @key_postfix    = @key_name + "_" + @key_postfix
end
filter_stream(tag, es) click to toggle source
# File lib/fluent/plugin/filter_resolv.rb, line 19
def filter_stream(tag, es)
  new_es = MultiEventStream.new
  tag = tag.sub(@remove_prefix, '') if @remove_prefix
  tag = (@add_prefix + '.' + tag) if @add_prefix

  es.each do |time,record|
    record[@key_postfix] = Resolv.getname(record[@key_name]) rescue nil
    new_es.add(time, record)
  end
  return new_es
end