Class: Fluent::Plugin::GeoipOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::GeoipOutput
- Defined in:
- lib/fluent/plugin/out_geoip.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
- #formatted_to_msgpack_binary ⇒ Object
- #multi_workers_ready? ⇒ Boolean
- #write(chunk) ⇒ Object
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) compat_parameters_convert(conf, :buffer, :inject, default_chunk_key: 'tag') super raise Fluetn::ConfigError, "chunk key must include 'tag'" unless @chunk_key_tag placeholder_validate!(:tag, @tag) if @tag @geoip = Fluent::GeoIP.new(self, conf) end |
#format(tag, time, record) ⇒ Object
33 34 35 36 |
# File 'lib/fluent/plugin/out_geoip.rb', line 33 def format(tag, time, record) record = inject_values_to_record(tag, time, record) [tag, time, record].to_msgpack end |
#formatted_to_msgpack_binary ⇒ Object
38 39 40 |
# File 'lib/fluent/plugin/out_geoip.rb', line 38 def formatted_to_msgpack_binary true end |
#multi_workers_ready? ⇒ Boolean
53 54 55 |
# File 'lib/fluent/plugin/out_geoip.rb', line 53 def multi_workers_ready? true end |
#write(chunk) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fluent/plugin/out_geoip.rb', line 42 def write(chunk) es = Fluent::MultiEventStream.new tag = "" chunk.each do |_tag, time, record| tag = _tag es.add(time, @geoip.add_geoip_field(record)) end tag = extract_placeholders(@tag, chunk.) if @tag router.emit_stream(tag, es) end |