Sha256: 7d174fe8da986bcb88c74d86402e13c210f96fc2f5d32050d417ecc77e2f6706

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

require 'fluent/plugin/output'
require 'google/cloud/logging'

module Fluent
  module Plugin
    # fluentd output plugin for google cloud logging
    class GoogleCloudLoggingOnPrem < Output
      attr_writer :logger

      Fluent::Plugin.register_output('google_cloud_logging_on_prem', self)

      config_param :project_id, :string

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

      def process(tag, entries)
        entries.each do |time, record|
          entry = logger.entry

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

          logger.write_entries(entry)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-google-cloud-logging-on-prem-0.1.0 lib/fluent/plugin/out_google_cloud_logging_on_prem.rb