Class: LogStash::Filters::IP2Proxy
- Inherits:
-
Base
- Object
- Base
- LogStash::Filters::IP2Proxy
- Defined in:
- lib/logstash/filters/ip2proxy.rb
Instance Method Summary collapse
Instance Method Details
#filter(event) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/logstash/filters/ip2proxy.rb', line 37 def filter(event) return unless filter?(event) if @ip2proxyfilter.handleEvent(event) filter_matched(event) else tag_iplookup_unsuccessful(event) end end |
#register ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/logstash/filters/ip2proxy.rb', line 22 def register if @database.nil? @database = ::Dir.glob(::File.join(::File.("../../../vendor/", ::File.dirname(__FILE__)),"IP2PROXY-LITE-PX4.BIN")).first if @database.nil? || !File.exists?(@database) raise "You must specify 'database => ...' in your ip2proxy filter (I looked for '#{@database}')" end end @logger.info("Using ip2proxy database", :path => @database) @ip2proxyfilter = org.logstash.filters.IP2ProxyFilter.new(@source, @target, @database) end |
#tag_iplookup_unsuccessful(event) ⇒ Object
46 47 48 |
# File 'lib/logstash/filters/ip2proxy.rb', line 46 def tag_iplookup_unsuccessful(event) @logger.debug? && @logger.debug("IP #{event.get(@source)} was not found in the database", :event => event) end |