Class: Fluent::LogDNAOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::LogDNAOutput
- Defined in:
- lib/fluent/plugin/out_logdna.rb
Constant Summary collapse
- INGESTER_DOMAIN =
'https://logs.logdna.com'.freeze
- 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
16 17 18 19 |
# File 'lib/fluent/plugin/out_logdna.rb', line 16 def configure(conf) super @host = conf['hostname'] end |
#format(tag, time, record) ⇒ Object
36 37 38 |
# File 'lib/fluent/plugin/out_logdna.rb', line 36 def format(tag, time, record) [tag, time, record].to_msgpack end |
#shutdown ⇒ Object
31 32 33 34 |
# File 'lib/fluent/plugin/out_logdna.rb', line 31 def shutdown super @ingester.close if @ingester end |
#start ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/fluent/plugin/out_logdna.rb', line 21 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
40 41 42 43 44 45 |
# File 'lib/fluent/plugin/out_logdna.rb', line 40 def write(chunk) body = chunk_to_body(chunk) response = send_request(body) raise 'Encountered server error' if response.code >= 400 response.flush end |