Google Cloud Logging

Route logs from Cloud Run, Cloud Functions, GKE and App Engine to Flowhawk with a log sink and a Pub/Sub push subscription.

A log sink copies matching entries to a Pub/Sub topic, and a push subscription delivers them to Flowhawk. Google signs each push, and Flowhawk checks that signature, so no key travels in a URL.

What you get

  • Google Cloud logs in Logs, next to your traces and metrics, searchable with the same query language (severity>=WARN service=checkout "timeout"), grouped into patterns or followed live.
  • A log line that names a request path joins the business flow of that route, so a failing checkout shows its platform logs on the checkout flow's page.
  • A line that carries a trace id opens its trace.
  • Alert on any search with Alert on this, and let the agent read these logs when it investigates an incident.

Entries keep their trace and span ids, so a Cloud Run request log opens the trace that Cloud Trace or OpenTelemetry recorded for it.

Set it up

First create an ingest key: in the app, open Settings > API keys and pick Services. In the examples below, KEY stands for that key. Keep it out of your repository, like any other secret.

Pub/Sub can't send headers. Instead, turn on authentication for the push subscription and set its audience to your ingest key: Google signs the audience into a token, and Flowhawk reads the key from it after checking Google's signature.

gcloud pubsub topics create flowhawk-logs
gcloud logging sinks create flowhawk-logs pubsub.googleapis.com/projects/PROJECT/topics/flowhawk-logs \
  --log-filter='severity>=INFO'
gcloud pubsub subscriptions create flowhawk-logs --topic=flowhawk-logs \
  --push-endpoint=https://api.flowhawk.dev/v1/logs/gcp \
  --push-auth-service-account=SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com \
  --push-auth-token-audience=KEY

Then give the sink's writer identity (shown by gcloud logging sinks describe flowhawk-logs) the Pub/Sub Publisher role on the topic.

The same steps, with your workspace's address filled in, are in the app under Settings > Integrations > Log drains.

What arrives

Google CloudIn Flowhawk
Cloud Run, Cloud Functions, GKE, App Engine resourceThe service, named after the Cloud Run service, function, container or App Engine module
severityThe level
trace, spanIdA link to the trace
httpRequestMethod and path, used to find the request's flow
jsonPayloadThe message and its fields as attributes

Common questions

How do I send fewer logs?

Change the sink's --log-filter, for example to severity>=WARNING, or limit it to one service with resource.labels.service_name="checkout".