Sha256: e896297fc5e2fbf2d89741f6404de9999d9570dd5f8b4d39b527666402c18943
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'fluent/plugin/geoip' module Fluent class GeoipFilter < Filter Plugin.register_filter('geoip', self) config_param :geoip_database, :string, :default => File.dirname(__FILE__) + '/../../../data/GeoLiteCity.dat' config_param :geoip2_database, :string, :default => File.dirname(__FILE__) + '/../../../data/GeoLite2-City.mmdb' config_param :geoip_lookup_key, :string, :default => 'host' config_param :skip_adding_null_record, :bool, :default => false config_set_default :include_tag_key, false config_param :hostname_command, :string, :default => 'hostname' config_param :flush_interval, :time, :default => 0 config_param :log_level, :string, :default => 'warn' config_param :backend_library, :enum, :list => Fluent::GeoIP::BACKEND_LIBRARIES, :default => :geoip def configure(conf) super @geoip = Fluent::GeoIP.new(self, conf) end def filter_stream(tag, es) new_es = MultiEventStream.new es.each do |time, record| begin filtered_record = @geoip.add_geoip_field(record) new_es.add(time, filtered_record) if filtered_record rescue => e router.emit_error_event(tag, time, record, e) end end new_es end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-geoip-0.8.1 | lib/fluent/plugin/filter_geoip.rb |
fluent-plugin-geoip-0.8.0 | lib/fluent/plugin/filter_geoip.rb |
fluent-plugin-geoip-0.7.0 | lib/fluent/plugin/filter_geoip.rb |