Class: Fluent::LogfireOutput

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

Constant Summary collapse

VERSION =
"0.1.0".freeze
CONTENT_TYPE =
"application/msgpack".freeze
HOST =
"in.logfire.sh".freeze
PORT =
443
PATH =
"/".freeze
MAX_ATTEMPTS =
3.freeze
RETRYABLE_CODES =
[429, 500, 502, 503, 504].freeze
USER_AGENT =
"logfire Fluentd/#{VERSION}".freeze

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



20
21
22
23
# File 'lib/fluent/plugin/out_logfire.rb', line 20

def configure(conf)
  @source_token = conf["source_token"]
  super
end

#format(tag, time, record) ⇒ Object



25
26
27
# File 'lib/fluent/plugin/out_logfire.rb', line 25

def format(tag, time, record)
  force_utf8_string_values(record.merge("dt" => Time.at(time).utc.iso8601)).to_msgpack
end

#write(chunk) ⇒ Object



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

def write(chunk)
  deliver(chunk, 1)
end