Class: GRI::FluentWriter
- Defined in:
- lib/gri/plugin/writer_fluentd.rb
Constant Summary
Constants inherited from Writer
Instance Attribute Summary
Attributes inherited from Writer
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FluentWriter
constructor
A new instance of FluentWriter.
- #write(records) ⇒ Object
Methods inherited from Writer
Constructor Details
#initialize(options = {}) ⇒ FluentWriter
Returns a new instance of FluentWriter.
11 12 13 14 15 |
# File 'lib/gri/plugin/writer_fluentd.rb', line 11 def initialize ={} @options = host = [:fluent_host] @sock = TCPSocket.new host, 24224 end |
Instance Method Details
#write(records) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/gri/plugin/writer_fluentd.rb', line 17 def write records time = Time.now.to_i for record in records tag = @options[:fluent_tag] || "gri.#{record['_key']}" s = [tag, time, record].to_msgpack @sock.write s end end |