Class: Fluent::GeoipOutput

Inherits:
BufferedOutput
  • Object
show all
Includes:
HandleTagNameMixin, Mixin::RewriteTagName, SetTagKeyMixin
Defined in:
lib/fluent/plugin/out_geoip.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fluent/plugin/out_geoip.rb', line 25

def configure(conf)
  super
  Fluent::GeoIP.class_eval do
    include Fluent::Mixin::RewriteTagName
  end
  @geoip = Fluent::GeoIP.new(self, conf)
end

#format(tag, time, record) ⇒ Object



37
38
39
# File 'lib/fluent/plugin/out_geoip.rb', line 37

def format(tag, time, record)
  [tag, time, record].to_msgpack
end

#shutdownObject



41
42
43
# File 'lib/fluent/plugin/out_geoip.rb', line 41

def shutdown
  super
end

#startObject



33
34
35
# File 'lib/fluent/plugin/out_geoip.rb', line 33

def start
  super
end

#write(chunk) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/fluent/plugin/out_geoip.rb', line 45

def write(chunk)
  es = Fluent::MultiEventStream.new
  tag = ""
  chunk.msgpack_each do |_tag, time, record|
    tag = _tag
    es.add(time, @geoip.add_geoip_field(record))
  end
  router.emit_stream(tag, es)
end