Module: Fluent::GoogleCloudOutput::InternalConstants

Defined in:
lib/fluent/plugin/out_google_cloud.rb

Overview

Constants for log entry field extraction.

Constant Summary collapse

LOCAL_RESOURCE_ID_KEY =

The label name of local_resource_id in the json payload. When a record has this field in the payload, we will use the value to retrieve monitored resource from Stackdriver Metadata agent.

'logging.googleapis.com/local_resource_id'
LOG_ENTRY_FIELDS_MAP =

Map from each field name under LogEntry to corresponding variables required to perform field value extraction from the log record.

{
  'http_request' => [
    # The config to specify label name for field extraction from record.
    '@http_request_key',
    # Map from subfields' names to their types.
    [
      # subfield key in the payload, destination key, cast lambda (opt)
      %w(requestMethod request_method parse_string),
      %w(requestUrl request_url parse_string),
      %w(requestSize request_size parse_int),
      %w(status status parse_int),
      %w(responseSize response_size parse_int),
      %w(userAgent user_agent parse_string),
      %w(remoteIp remote_ip parse_string),
      %w(referer referer parse_string),
      %w(cacheHit cache_hit parse_bool),
      %w(cacheValidatedWithOriginServer
         cache_validated_with_origin_server parse_bool),
      %w(latency latency parse_latency)
    ],
    # The grpc version class name.
    'Google::Logging::Type::HttpRequest',
    # The non-grpc version class name.
    'Google::Apis::LoggingV2beta1::HttpRequest'
  ],
  'source_location' => [
    '@source_location_key',
    [
      %w(file file parse_string),
      %w(function function parse_string),
      %w(line line parse_int)
    ],
    'Google::Logging::V2::LogEntrySourceLocation',
    'Google::Apis::LoggingV2beta1::LogEntrySourceLocation'
  ],
  'operation' => [
    '@operation_key',
    [
      %w(id id parse_string),
      %w(producer producer parse_string),
      %w(first first parse_bool),
      %w(last last parse_bool)
    ],
    'Google::Logging::V2::LogEntryOperation',
    'Google::Apis::LoggingV2beta1::LogEntryOperation'
  ]
}