Skip to content

to_google_cloud_logging

Sends events to Google Cloud Logging.

to_google_cloud_logging name=string, resource_type=string,
[resource_labels=record, payload=string, service_credentials=string,
severity=string, timestamp=time, batch_timeout=duration,
max_batch_size=int]

The to_google_cloud_logging operator sends events to Google Cloud Logging.

You can either send an unstructured log in the form of a string to Cloud Logging by explicitly providing the log via the payload option, or you can ignore the payload option and the operator will then assemble a JSON object from the event and send that to Cloud Logging.

The resource name for the associated log entry. Must have one of the following formats:

  • projects/[PROJECT_ID]/logs/[LOG_ID]
  • organizations/[ORGANIZATION_ID]/logs/[LOG_ID]
  • billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]
  • folders/[FOLDER_ID]/logs/[LOG_ID]

Note the following constraints on [LOG_ID]:

  • The value must be URL-encoded within name, e.g., "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity".
  • The value must be less than 512 characters long.
  • The value can only include the following characters:
    • Upper and lower case alphanumeric characters
    • Forward-slash
    • Underscore
    • Hyphen
    • Period

The type of the monitored resource. All available types with their associated labels are listed here.

Record of associated labels for the resource. Values of the record must be of type string. All available types with their associated labels are listed here.

The log entry payload. If unspecified, the incoming event is serialized as JSON and sent.

Credentials to use if using a service account.

Severity of the event. Available severity levels are documented here.

Defaults to default.

Timestamp of the event.

Maximum interval between sending the events.

Defaults to 5s.

Maximum events to batch before sending.

Defaults to 1k.

Send logs, authenticating automatically via ADC

Section titled “Send logs, authenticating automatically via ADC”
from {
content: "log message",
timestamp: now(),
}
to_google_cloud_logging name="projects/PROJECT_ID/logs/LOG_ID",
resource_type="global"
from {
content: "totally not a made up log",
timestamp: now(),
resource: "global",
}
to_google_cloud_logging name="projects/PROJECT_ID/logs/LOG_ID",
resource_type=resource,
service_credentials=file_contents("/path/to/credentials.json")

to_google_secops