Class: LogStash::Filters::List2fields

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/filters/list2fields.rb

Overview

TODO docu

Instance Method Summary collapse

Instance Method Details

#filter(event) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/logstash/filters/list2fields.rb', line 28

def filter(event)
  input = event[@source]
  if !input.nil?  && (input.is_a? Enumerable)
    input.each do |entry|
      begin
        if entry.is_a?(::Hash)
          new_key = @prefix.to_s + entry[@key].to_s
          event[new_key] = entry[@value]
        else
          new_key = @prefix.to_s + entry.instance_variable_get("@" + @key)
          event[new_key] = entry.instance_variable_get("@" + @value)
        end # if is hash
      rescue 
        @logger.debug("Could not find key " + @key + " in incoming data, please check your config. ")
      end
    end # do     
  end # if input.nil? 
end

#registerObject



23
24
25
# File 'lib/logstash/filters/list2fields.rb', line 23

def register
  
end