gcloud builds log: Read Cloud Build Logs
gcloud builds log prints the logs for a given Cloud Build, with --stream to follow one in progress.
When a build submitted to Cloud Build fails, this pulls the full log by build ID so you can see the failing step without opening the console.
What it does
gcloud builds log fetches the stored logs for a build identified by its UUID. With --stream it tails an in-progress build, printing steps as they run, which is handy when you trigger a build asynchronously.
Common usage
gcloud builds log 0f8c1d2e-3a4b-5c6d-7e8f-90123456789a
# follow the most recent build live
BID=$(gcloud builds list --limit=1 \
--format='value(id)' --ongoing)
gcloud builds log "$BID" --streamFlags
| Flag | What it does |
|---|---|
| <BUILD_ID> | UUID of the build to read |
| --stream | Tail logs of an in-progress build |
| --region <region> | Region for regional Cloud Build |
| --project <id> | Project the build ran in |
In CI
If you trigger builds with gcloud builds submit --async, capture the build ID and follow it with gcloud builds log --stream so the job surfaces failures inline. Authenticate keylessly with Workload Identity Federation.
Common errors in CI
"Build [id] not found" means a wrong ID or region; regional builds need a matching --region. "PERMISSION_DENIED ... cloudbuild.builds.get" needs roles/cloudbuild.builds.viewer. If logs go to a custom GCS bucket or Cloud Logging only, plain gcloud builds log may say logs are unavailable; read them via gcloud logging read instead.