Class: LogStash::Filters::Ipcat
- Inherits:
-
Base
- Object
- Base
- LogStash::Filters::Ipcat
- Defined in:
- lib/logstash/filters/ipcat.rb
Instance Method Summary collapse
Instance Method Details
#filter(event) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# 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 ⇒ Object
23 24 25 26 |
# File 'lib/logstash/filters/ipcat.rb', line 23 def register path = ::File.('../../../vendor/datacenters.csv', ::File.dirname(__FILE__)) @datacenters = IPCat::Datacenters.new path end |