
Answer-first summary for fast verification
Answer: Create a logs bucket and logging sink. Set the retention on the logs bucket to 365 days. Configure the logging sink to send logs to the bucket. Give your client access to the bucket to retrieve the logs.
The question requires a solution that ensures all logs are available for one year with minimal code changes. Option A suggests updating all images and functions to send logs to both Cloud Logging and the client's logging service, which involves significant code changes and is not minimal. Option B involves creating a Pub/Sub topic and subscription, which is a good approach for real-time log streaming but does not inherently ensure logs are stored for one year. Option C suggests updating all images and functions to send logs to a storage bucket, which again involves significant code changes. Option D is the best solution as it involves creating a logs bucket with a 365-day retention policy and a logging sink to send logs to the bucket. This approach requires minimal code changes, leverages Google Cloud's native capabilities for log retention, and provides the client with access to the logs.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are developing client applications on Cloud Run and Cloud Functions. Your client mandates that all logs must remain accessible for one year to allow importing into their logging service, while minimizing necessary code modifications. What is the recommended approach?
A
Update all images in Cloud Run and all functions in Cloud Functions to send logs to both Cloud Logging and the client's logging service. Ensure that all the ports required to send logs are open in the VPC firewall.
B
Create a Pub/Sub topic, subscription, and logging sink. Configure the logging sink to send all logs into the topic. Give your client access to the topic to retrieve the logs.
C
Create a storage bucket and appropriate VPC firewall rules. Update all images in Cloud Run and all functions in Cloud Functions to send logs to a file within the storage bucket.
D
Create a logs bucket and logging sink. Set the retention on the logs bucket to 365 days. Configure the logging sink to send logs to the bucket. Give your client access to the bucket to retrieve the logs.