Question

Difficulty: MediumConfiguring Cloud Logging, Monitoring, and Operational Alerting

An enterprise architecture team is configuring a centralized log sink in Google Cloud to route operational application logs from a workload project to a Cloud Storage bucket for compliance archiving. The team needs to prevent verbose debug logs from being exported to minimize storage costs, while ensuring the log sink's writer identity adheres strictly to the principle of least privilege on the destination storage bucket. Which approach correctly achieves this configuration?

  1. Define a log sink with a filter matching application logs with severity INFO or higher, and grant the sink's writer identity service account the Storage Object Creator role on the target Cloud Storage bucket.Answer
  2. B
    Define a log sink without filters and grant the sink's writer identity service account the Editor primitive role on the project containing the target Cloud Storage bucket.
  3. C
    Define a log sink with an exclusion filter set to severity >= INFO, and grant the sink's writer identity service account the Storage Object Admin role on the target bucket.
  4. D
    Define a log sink with a filter selecting all logs, and grant the operations team's service account the Service Account Admin role to dynamically manage bucket permissions.

Answer

Configure a log sink filter that includes logs with severity INFO or higher to exclude debug entries, and assign the Storage Object Creator role (`roles/storage.objectCreator`) directly to the log sink's unique writer identity service account on the destination Cloud Storage bucket.
The correct approach configures an inclusion filter (`severity >= INFO`) on the log sink so that low-priority DEBUG logs are filtered out prior to export, reducing storage costs. It then grants the minimal required IAM role (`roles/storage.objectCreator`) specifically to the log sink's unique writer identity service account on the destination bucket, satisfying least-privilege security mandates.

Step-by-Step Solution

1
Determine log filtering requirements.
Construct a log sink filter (e.g., `severity >= INFO`) to select operational logs while excluding DEBUG entries.
Filtering at the log sink prevents unnecessary log ingestion and storage overhead in the target sink destination.
2
Identify the writer identity of the log sink.
Obtain the unique service account email generated by Cloud Logging for the created sink (writerIdentity).
Cloud Logging exports logs using a dedicated service account identity per sink.
3
Apply least-privilege IAM permissions on the destination bucket.
Grant `roles/storage.objectCreator` to the writerIdentity on the target Cloud Storage bucket.
The Storage Object Creator role provides the exact permissions required to write log objects into the destination bucket without granting read, list, or administrative privileges.

Key Concept

Log sink filtering and least-privilege IAM configuration for Cloud Logging export destinations.
Rate this question