PROFESSIONAL-CLOUD-DEVELOPER · Question #108
Your team develops services that run on Google Kubernetes Engine. You need to standardize their log data using Google-recommended practices and make the data more useful in the fewest number of steps.
The correct answer is C. Write log output to standard output (stdout) as single-line JSON to be ingested into Cloud Logging D. Mandate the use of the Logging API in the application code to write structured logs to Cloud. Google's recommended practice for containerized applications on GKE is to write logs to stdout/stderr as structured JSON (Choice C). Cloud Logging automatically collects and parses these logs from GKE pods without any additional agent configuration. Writing structured (JSON) logs
Question
Your team develops services that run on Google Kubernetes Engine. You need to standardize their log data using Google-recommended practices and make the data more useful in the fewest number of steps. What should you do? (Choose two.)
Options
- ACreate aggregated exports on application logs to BigQuery to facilitate log analytics.
- BCreate aggregated exports on application logs to Cloud Storage to facilitate log analytics.
- CWrite log output to standard output (stdout) as single-line JSON to be ingested into Cloud Logging
- DMandate the use of the Logging API in the application code to write structured logs to Cloud
- EMandate the use of the Pub/Sub API to write structured data to Pub/Sub and create a Dataflow
How the community answered
(18 responses)- A6% (1)
- B11% (2)
- C78% (14)
- E6% (1)
Explanation
Google's recommended practice for containerized applications on GKE is to write logs to stdout/stderr as structured JSON (Choice C). Cloud Logging automatically collects and parses these logs from GKE pods without any additional agent configuration. Writing structured (JSON) logs instead of plain text makes log entries queryable and filterable. Choice D - using the Cloud Logging API to write structured logs - is also recommended when you need more control over log metadata, severity, and structured fields. Together, C and D achieve standardized, structured, queryable logs with minimal steps. Choices A and B (exporting to BigQuery/Cloud Storage) are downstream analytics actions, not standardization steps. Choice E (Pub/Sub + Dataflow) is a complex custom pipeline that adds unnecessary steps when Cloud Logging handles this natively.
Topics
Community Discussion
No community discussion yet for this question.