Class: Fluent::Plugin::GoogleCloudLoggingOnPrem

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_google_cloud_logging_on_prem.rb

Overview

fluentd output plugin for google cloud logging

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject



14
15
16
# File 'lib/fluent/plugin/out_google_cloud_logging_on_prem.rb', line 14

def logger
  @logger ||= Google::Cloud::Logging.new
end

Instance Method Details

#process(tag, entries) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fluent/plugin/out_google_cloud_logging_on_prem.rb', line 18

def process(tag, entries)
  entries.each do |time, record|
    entry = logger.entry
    time = Fluent::EventTime.new(time) if time.is_a?(Integer)

    entry.timestamp = time
    entry.payload = record
    entry.log_name = tag
    entry.resource.type = 'project'

    logger.write_entries(entry)
  end
end