Class: Fluent::LogDNAOutput

Inherits:
BufferedOutput
  • Object
show all
Defined in:
lib/fluent/plugin/out_logdna.rb

Constant Summary collapse

INGESTER_DOMAIN =
'https://logs.logdna.com'.freeze

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



15
16
17
18
# File 'lib/fluent/plugin/out_logdna.rb', line 15

def configure(conf)
  super
  @host = conf['hostname']
end

#format(tag, time, record) ⇒ Object



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

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

#shutdownObject



28
29
30
31
# File 'lib/fluent/plugin/out_logdna.rb', line 28

def shutdown
  super
  @ingester.close if @ingester
end

#startObject



20
21
22
23
24
25
26
# File 'lib/fluent/plugin/out_logdna.rb', line 20

def start
  super
  require 'json'
  require 'base64'
  require 'http'
  @ingester = HTTP.persistent INGESTER_DOMAIN
end

#write(chunk) ⇒ Object



37
38
39
40
41
# File 'lib/fluent/plugin/out_logdna.rb', line 37

def write(chunk)
  body = chunk_to_body(chunk)
  response = send_request(body)
  handle(response)
end