SigSentrySigSentry

GCP Cloud Logging

Connect Google Cloud Logging using a service account with read access

The GCP adapter uses the Cloud Logging API to query logs during analyses. You'll need a service account with roles/logging.viewer plus the JSON key.

Prerequisites

NeedNotes
GCP projectThe project where logs are stored
Service accountWith roles/logging.viewer
JSON keyService account key file
Log filter patternsCloud Logging filter expressions

Setup walkthrough

Create a service account

In the GCP Console, go to IAM & Admin → Service Accounts → Create Service Account. Name it something like sigsentry-logs-reader.

Grant the role:

RolePurpose
roles/logging.viewerRead access to logs

Skip the "Grant users access to this service account" step — you don't need to delegate.

For tighter scoping, restrict via the Conditions field on the role binding — e.g. only logs from specific log names or resource types.

Generate a JSON key

On the service account's page, Keys → Add key → Create new key → JSON. Download the JSON file and keep it safe — there's no way to retrieve it again.

Add the log source in SigSentry

Project → Log Sources → Add log source. Pick GCP Cloud Logging and name it gcp-prod or similar.

Enter credentials

FieldValue
Project IDThe GCP project ID where logs live
Service account JSONPaste the entire JSON key file content

The JSON is encrypted at rest and only used for authenticating to the Cloud Logging API.

Add log filters

Paste Cloud Logging filter expressions, one per line:

resource.type="k8s_container" resource.labels.namespace_name="prod"
resource.type="cloud_run_revision" resource.labels.service_name="checkout-api"
logName="projects/my-project/logs/run.googleapis.com%2Fstderr"

Each line is a complete filter expression and is queried independently.

Test and save

Click Test connection. You should see Connected plus sample log entries from a small recent window. Click Save.

What you'll see in results

Each GCP log entry shown in an analysis includes:

  • Timestamp
  • Log level (mapped from GCP severity)
  • Service name (from resource.labels.service_name, resource.labels.container_name, or resource.labels.namespace_name)
  • Message (from textPayload or jsonPayload.message)
  • Resource labels and full jsonPayload carried through as metadata

Quirks

QuirkNotes
Severity valuesGCP uses uppercase severity strings (ERROR, INFO); we lowercase them
Structured vs text payloadsBoth are supported; structured payloads expose the full JSON in metadata
Log routingIf you've routed logs to a different project, point Project ID at the destination

Troubleshooting

ErrorFix
401 PERMISSION_DENIEDService account lacks roles/logging.viewer; re-grant
403 forbiddenLogs may be in a different project than the JSON key's project
Invalid filterFilter syntax error — test the expression in the GCP Logs Explorer first
Empty results despite log activityFilter too narrow or wrong project; verify in Logs Explorer with the same filter