While debugging a Cloud Function written in Python, you emit structured logs by writing json.dumps({ "action": "create", "user": "alice" }) to stdout. In Cloud Logging's Logs Explorer you expand one of these entries to verify the key-value pairs. In which top-level field of the log entry should you expect to find the action and user keys?
When an application writes valid JSON to stdout or stderr, Cloud Logging treats the output as a structured log. The key-value pairs are stored in the log entry's jsonPayload field. The textPayload field is used for unstructured text, labels holds user-defined metadata attached to the log entry, and resource.labels contains information that identifies the monitored resource (for example, project_id or instance_id). Therefore, the correct location for the "action" and "user" keys is jsonPayload.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between jsonPayload and textPayload in Cloud Logging?
Open an interactive chat with Bash
What are resource.labels in Cloud Logging?
Open an interactive chat with Bash
How does Cloud Logging handle structured logs written to stdout?
Open an interactive chat with Bash
What is jsonPayload in Cloud Logging?
Open an interactive chat with Bash
How does Cloud Logging differentiate between jsonPayload and textPayload?
Open an interactive chat with Bash
What is the purpose of resource.labels in Cloud Logging?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Ensuring successful operation of a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .