Sha256: 82cea13fb52af30dabb2b65608623cbf7d66ad58ad6f1d4667ba7fded8ea79c9
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require 'fluent/mixin/rewrite_tag_name' class Fluent::GeoipOutput < Fluent::BufferedOutput Fluent::Plugin.register_output('geoip', self) config_param :geoip_database, :string, :default => File.dirname(__FILE__) + '/../../../data/GeoLiteCity.dat' config_param :geoip_lookup_key, :string, :default => 'host' config_param :tag, :string, :default => nil config_param :skip_adding_null_record, :bool, :default => false include Fluent::HandleTagNameMixin include Fluent::SetTagKeyMixin config_set_default :include_tag_key, false include Fluent::Mixin::RewriteTagName config_param :hostname_command, :string, :default => 'hostname' config_param :flush_interval, :time, :default => 0 config_param :log_level, :string, :default => 'warn' # Define `log` method for v0.10.42 or earlier unless method_defined?(:log) define_method("log") { $log } end # To support Fluentd v0.10.57 or earlier unless method_defined?(:router) define_method("router") { Fluent::Engine } end def initialize require 'fluent/plugin/geoip' super end def configure(conf) super Fluent::GeoIP.class_eval do include Fluent::Mixin::RewriteTagName end @geoip = Fluent::GeoIP.new(self, conf) end def start super end def format(tag, time, record) [tag, time, record].to_msgpack end def shutdown super end def write(chunk) chunk.msgpack_each do |tag, time, record| router.emit(tag, time, @geoip.add_geoip_field(record)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-geoip-0.6.0 | lib/fluent/plugin/out_geoip.rb |