Module: Fluent::GoogleCloudOutput::InternalConstants

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

Overview

Internal constants.

Constant Summary collapse

CREDENTIALS_PATH_ENV_VAR =
'GOOGLE_APPLICATION_CREDENTIALS'.freeze
DEFAULT_LOGGING_API_URL =
'https://logging.googleapis.com'.freeze
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'.freeze
STACKDRIVER_TRACE_ID_REGEXP =

The regexp matches stackdriver trace id format: 32-byte hex string. The format is documented in cloud.google.com/trace/docs/reference/v2/rpc/google.devtools.cloudtrace.v1#trace

Regexp.new('^\h{32}$').freeze
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(cacheFillBytes cache_fill_bytes parse_int),
      %w(cacheHit cache_hit parse_bool),
      %w(cacheLookup cache_lookup parse_bool),
      %w(cacheValidatedWithOriginServer
         cache_validated_with_origin_server parse_bool),
      %w(latency latency parse_latency),
      %w(protocol protocol parse_string),
      %w(referer referer parse_string),
      %w(remoteIp remote_ip parse_string),
      %w(responseSize response_size parse_int),
      %w(requestMethod request_method parse_string),
      %w(requestSize request_size parse_int),
      %w(requestUrl request_url parse_string),
      %w(serverIp server_ip parse_string),
      %w(status status parse_int),
      %w(userAgent user_agent parse_string)
    ],
    # The grpc version class name.
    'Google::Logging::Type::HttpRequest',
    # The non-grpc version class name.
    'Google::Apis::LoggingV2::HttpRequest'
  ],
  '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::LoggingV2::LogEntryOperation'
  ],
  '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::LoggingV2::LogEntrySourceLocation'
  ]
}.freeze
PARTIAL_ERROR_FIELD =

The name of the WriteLogEntriesPartialErrors field in the error details.

'type.googleapis.com/google.logging.v2.WriteLogEntriesPartialErrors' \
.freeze