nerdexam
Google

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.

Submitted by takeshi77· Apr 18, 2026Implementing service monitoring strategies

Question

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 logging service. You must minimize required code changes. What should you do?

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)
  • A
    3% (1)
  • B
    6% (2)
  • C
    11% (4)
  • D
    80% (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.

AUpdate all images in Cloud Run and all functions in Cloud Functions to send logs to both Cloud

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.

BCreate a Pub/Sub topic, subscription, and logging sink. Configure the logging sink to send all logs

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.

CCreate a storage bucket and appropriate VPC firewall rules. Update all images in Cloud Run and

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.

DCreate a logs bucket and logging sink. Set the retention on the logs bucket to 365 days.Correct

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

#Cloud Logging#Log Retention#Cloud Run#Cloud Functions

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Practice