PROFESSIONAL-CLOUD-DEVELOPER · Question #267
You have an application running on Google Kubernetes Engine (GKE). The application is currently using a logging library and is outputting to standard output. You need to export the logs to Cloud…
The correct answer is B. Update your application to output logs in JSON format, and add the necessary metadata to the. Updating the application to output structured JSON logs to stdout is the simplest method. GKE nodes already run the Cloud Logging agent (Fluent Bit), which automatically forwards stdout logs to Cloud Logging. When logs are structured JSON, Cloud Logging parses them and extracts…
Question
You have an application running on Google Kubernetes Engine (GKE). The application is currently using a logging library and is outputting to standard output. You need to export the logs to Cloud Logging, and you need the logs to include metadata about each request. You want to use the simplest method to accomplish this. What should you do?
Options
- AChange your application's logging library to the Cloud Logging library, and configure your
- BUpdate your application to output logs in JSON format, and add the necessary metadata to the
- CUpdate your application to output logs in CSV format, and add the necessary metadata to the
- DInstall the Fluent Bit agent on each of your GKE nodes, and have the agent export all logs from
How the community answered
(24 responses)- A4% (1)
- B71% (17)
- C17% (4)
- D8% (2)
Explanation
Updating the application to output structured JSON logs to stdout is the simplest method. GKE nodes already run the Cloud Logging agent (Fluent Bit), which automatically forwards stdout logs to Cloud Logging. When logs are structured JSON, Cloud Logging parses them and extracts fields like httpRequest, labels, and trace metadata automatically-no code library changes or additional agents required. Choice A requires changing the logging library and application code, which is more invasive. Choice C uses CSV format, which Cloud Logging does not natively parse for metadata extraction. Choice D is incorrect because Fluent Bit is already installed by default on GKE nodes; manually installing it again is unnecessary and adds complexity.
Topics
Community Discussion
No community discussion yet for this question.