PROFESSIONAL-CLOUD-DEVOPS-ENGINEER · Question #80
You are building and running client applications in Cloud Run and Cloud Functions. Your client requires that all logs must be available for one year so that the client can import the logs into their…
The correct answer is D. Create a logs bucket and logging sink. Set the retention on the logs bucket to 365 days. To retain Cloud Run and Cloud Functions logs for one year with minimal code changes, create a Cloud Logging logs bucket with 365-day retention and configure a logging sink to route all logs to it.
Question
Options
- AUpdate all images in Cloud Run and all functions in Cloud Functions to send logs to both Cloud
- BCreate a Pub/Sub topic, subscription, and logging sink. Configure the logging sink to send all logs
- CCreate a storage bucket and appropriate VPC firewall rules. Update all images in Cloud Run and
- DCreate a logs bucket and logging sink. Set the retention on the logs bucket to 365 days.
How the community answered
(35 responses)- A3% (1)
- B6% (2)
- C11% (4)
- D80% (28)
Why each option
To retain Cloud Run and Cloud Functions logs for one year with minimal code changes, create a Cloud Logging logs bucket with 365-day retention and configure a logging sink to route all logs to it.
Updating all application images and functions to send logs to two different destinations would require significant code changes, violating the requirement to minimize code changes.
While Pub/Sub can be an intermediary, a dedicated Cloud Logging logs bucket provides a more direct and managed solution for long-term log retention and is automatically integrated with Cloud Logging, simplifying the solution.
Creating a general Cloud Storage bucket requires additional configuration for log management and implies code changes for applications to write directly, and VPC firewall rules are generally not relevant for Cloud Run/Functions logging.
Cloud Run and Cloud Functions automatically send logs to Cloud Logging, requiring no code changes. By creating a dedicated Cloud Logging logs bucket with a 365-day retention policy and configuring a logging sink to route the logs there, you satisfy the one-year retention requirement using managed services while minimizing application code changes.
Concept tested: Cloud Logging sinks and logs bucket retention
Source: https://cloud.google.com/logging/docs/export/configure_export_sinks
Topics
Community Discussion
No community discussion yet for this question.