Class: Fluent::LogDNAOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::LogDNAOutput
- Defined in:
- lib/fluent/plugin/out_logdna.rb
Constant Summary collapse
- MAX_RETRIES =
5
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Instance Method Details
#configure(conf) ⇒ Object
17 18 19 20 |
# File 'lib/fluent/plugin/out_logdna.rb', line 17 def configure(conf) super @host = conf['hostname'] end |
#format(tag, time, record) ⇒ Object
37 38 39 |
# File 'lib/fluent/plugin/out_logdna.rb', line 37 def format(tag, time, record) [tag, time, record].to_msgpack end |
#shutdown ⇒ Object
32 33 34 35 |
# File 'lib/fluent/plugin/out_logdna.rb', line 32 def shutdown super @ingester.close if @ingester end |
#start ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/out_logdna.rb', line 22 def start super require 'json' require 'base64' require 'http' HTTP. = { :keep_alive_timeout => 60 } @ingester = HTTP.persistent @ingester_domain @requests = Queue.new end |
#write(chunk) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/fluent/plugin/out_logdna.rb', line 41 def write(chunk) body = chunk_to_body(chunk) response = send_request(body) raise 'Encountered server error' if response.code >= 400 response.flush end |