class Fluent::BaritoVMOutput

Constants

PLUGIN_NAME

Public Instance Methods

format(tag, time, record) click to toggle source

Overide from BufferedOutput

# File lib/fluent/plugin/out_barito_vm.rb, line 24
def format(tag, time, record)
  [tag, time, record].to_msgpack
end
start() click to toggle source

Overide from BufferedOutput

Calls superclass method
# File lib/fluent/plugin/out_barito_vm.rb, line 19
def start
  super
end
write(chunk) click to toggle source

Overide from BufferedOutput

# File lib/fluent/plugin/out_barito_vm.rb, line 29
def write(chunk)
  chunk.msgpack_each do |tag, time, record|
    transport = Fluent::Plugin::BaritoTransport.new(@produce_url, log)
    trail = Fluent::Plugin::ClientTrail.new(false)
    timber = Fluent::Plugin::TimberFactory::create_timber(tag, time, record, trail)

    if @application_secret.nil? or @application_secret.empty?
      next if @application_group_secret.nil? or @application_name.nil?
      header = {
        content_type: :json,
        'X-App-Group-Secret' => @application_group_secret,
        'X-App-Name' => @application_name
      }
    else
      header = {content_type: :json, 'X-App-Secret' => @application_secret}
    end
    transport.send(timber, header)
  end
end