class LogStash::Filters::Ipcat
Public Instance Methods
filter(event)
click to toggle source
# File lib/logstash/filters/ipcat.rb, line 30 def filter(event) ip = event[@source] ip = ip[0] if ip.instance_of? Array d = @datacenters.find(ip) event[@target] = d # filter_matched should go in the last line of our successful code filter_matched(event) end
register()
click to toggle source
# File lib/logstash/filters/ipcat.rb, line 23 def register path = ::File.expand_path('../../../vendor/datacenters.csv', ::File.dirname(__FILE__)) @datacenters = IPCat::Datacenters.new path end