class Fluent::Plugin::OCILoggingOutput

OCI Logging Fluentd Output plugin

Attributes

client[RW]
hostname[RW]

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_oci_logging.rb, line 45
def configure(conf)
  super
  log.debug 'determining the signer type'

  oci_config, signer_type = get_signer_type(principal_override: @principal_override)
  signer = get_signer(oci_config, signer_type)
  log.info "using authentication principal #{signer_type}"

  @client = OCI::Loggingingestion::LoggingClient.new(
    config: oci_config,
    endpoint: get_logging_endpoint(@region, logging_endpoint_override: @logging_endpoint_override),
    signer: signer,
    proxy_settings: nil,
    retry_config: nil
  )

  @client.api_client.request_option_overrides = { ca_file: @ca_file }
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_oci_logging.rb, line 64
def start
  super
  log.debug 'start'
end
write(chunk) click to toggle source
Sync Buffered Output ##############################

Implement write() if your plugin uses a normal buffer.

# File lib/fluent/plugin/out_oci_logging.rb, line 72
def write(chunk)
  log.debug "writing chunk metadata #{chunk.metadata}", \
            dump_unique_id_hex(chunk.unique_id)
  log_batches_map = {}

  # For standard chunk format (without #format() method)
  chunk.each do |time, record|
    begin
      tag = get_modified_tag(chunk.metadata.tag)
      source_identifier = record.key?('tailed_path') ? record['tailed_path'] : ''
      build_request(time, record, tag, log_batches_map, source_identifier)
    rescue StandardError => e
      log.error(e.full_message)
    end
  end

  send_requests(log_batches_map)  # flush data
end