PROFESSIONAL-CLOUD-DEVELOPER · Question #349
Your company recently modernized their monolith ecommerce site to a microservices application in GKE. Your team uses Google Cloud's operations suite for monitoring and logging. You want to improve the
The correct answer is C. Update your microservices code to emit logs in JSON format.. Cloud Logging automatically parses and indexes JSON-formatted logs as structured log entries, creating individual fields for each JSON key. This makes logs searchable by any field (e.g., severity, trace ID, user ID) using the Logs Explorer, dramatically improving both indexing an
Question
Your company recently modernized their monolith ecommerce site to a microservices application in GKE. Your team uses Google Cloud's operations suite for monitoring and logging. You want to improve the logging indexing and searchabilty in Cloud Logging across your microservices with the least amount of effort. What should you do?
Options
- AAsk the SRE team to enable Managed Service for Prometheus on your GKE cluster.
- BReconfigure your applications to write logs to an emptyDir volume. Configure a sidecar agent to
- CUpdate your microservices code to emit logs in JSON format.
- DInstrument your microservices code with OpenTelemetry libraries.
How the community answered
(37 responses)- A5% (2)
- B11% (4)
- C81% (30)
- D3% (1)
Explanation
Cloud Logging automatically parses and indexes JSON-formatted logs as structured log entries, creating individual fields for each JSON key. This makes logs searchable by any field (e.g., severity, trace ID, user ID) using the Logs Explorer, dramatically improving both indexing and searchability with no infrastructure changes - just a code change to the log output format. Option A (Managed Service for Prometheus) is a metrics collection solution, not a logging improvement. Option B (sidecar agent with emptyDir) adds infrastructure complexity and doesn't improve searchability unless the logs are also structured. Option D (OpenTelemetry) primarily addresses distributed tracing; while it can emit logs, the main benefit for searchability comes from the structured JSON format, not from the OpenTelemetry libraries themselves.
Topics
Community Discussion
No community discussion yet for this question.