mediumMultiple ChoiceObjective-mapped
Google ACE Practice Question: Your application writes structured JSON logs to…
Your application writes structured JSON logs to stdout from a Cloud Run service. You want to query logs in Cloud Logging to find all requests where the `user_id` field equals `12345`. Which log query syntax finds these entries?
⚠ Common exam trap
Google Cloud often tests the distinction between `jsonPayload` for structured logs and `textPayload` for unstructured logs, and candidates mistakenly use `textPayload` or confuse `resource.labels` with application-level JSON fields.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
`jsonPayload.user_id="12345"`
Cloud Logging uses the `jsonPayload` field to access structured JSON fields in log entries. When your application writes structured JSON logs to stdout, Cloud Run automatically parses them and stores the fields under `jsonPayload`. The query `jsonPayload.user_id="12345"` directly matches the `user_id` field within that JSON payload.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
`textPayload:"user_id:12345"`
Why it's wrong here
The textPayload field in Cloud Logging is reserved for unstructured log content, such as plain-text stdout lines. When Cloud Run sees JSON written to stdout, it parses the message into jsonPayload instead, so a filter like textPayload:"user_id:12345" scans raw text entries that won't contain this parsed key. Even if the string appeared inside a JSON string, the structured field is stored under jsonPayload, not textPayload.
- ✓
`jsonPayload.user_id="12345"`
Why this is correct
This is the correct filter because Cloud Run automatically converts JSON-formatted lines written to stdout/stderr into structured LogEntry objects whose contents populate jsonPayload. Using jsonPayload.user_id="12345" directly compares the value of the user_id field inside that JSON object, giving a precise, indexed lookup. It follows Cloud Logging's filter syntax and avoids text scanning or guessing at metadata.
- ✗
`resource.labels.user_id="12345"`
Why it's wrong here
resource.labels are system-assigned metadata describing the monitored GCP resource itself, such as a Cloud Run service's project_id, location, service_name, and revision_name. These labels identify the infrastructure, not application-specific fields from your log entries. Since user_id is a value inside the log payload, referencing resource.labels.user_id looks for a resource label that doesn't exist, so this filter returns no matching entries.
- ✗
`labels.user_id="12345"`
Why it's wrong here
The top-level labels field in a LogEntry stores key-value metadata attached to the log entry itself, such as resource labels or custom labels added by the logging agent or platform. Cloud Run's application JSON fields are not copied into these labels; they remain in jsonPayload. Thus labels.user_id="12345" searches entry metadata where user_id is not assigned, making the filter valid syntactically but empty in results.
Go deeper
Related to this question
Learn chapter
Google Cloud Platform Overview
Key term
Cloud logging
Cloud logging is the practice of collecting, storing, and analyzing log data generated by cloud-based resources and applications to monitor performance, troubleshoot issues, and maintain security.
Key term
Cloud Run
Cloud Run is a fully managed compute platform from Google Cloud that lets you run containerized applications in a serverless environment, automatically scaling from zero to thousands of requests.
About these practice questions
One of 769 original ACE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.