Question

Difficulty: MediumMonitoring and Logging

A cloud engineer needs to export application error logs from a Google Cloud project to an analytics team's BigQuery dataset located in a different project. The engineer configures a Cloud Logging Log Router sink with a BigQuery destination. What step must be completed to allow the sink to successfully write log entries to the destination dataset using least-privilege security practices?

  1. Grant the BigQuery Data Editor role to the unique writer identity service account generated by the Log Router sink on the target BigQuery dataset.Answer
  2. B
    Assign the Project Owner primitive role to the default Compute Engine service account at the source project level.
  3. C
    Enable the Cloud Logging API in the target BigQuery project rather than the source project generating the log entries.
  4. D
    Revoke BigQuery permissions at the target project level, assuming that folder-level IAM deny policies will automatically allow sink exports.

Answer

Grant the BigQuery Data Editor role to the unique writer identity service account generated by the Log Router sink on the target BigQuery dataset.
When configuring a Cloud Logging Log Router sink to export logs to a resource in another project (such as a BigQuery dataset), Cloud Logging generates a unique service account known as the sink's writer identity. To allow log ingestion, the administrator must grant this specific writer identity the appropriate predefined role (BigQuery Data Editor) directly on the destination dataset.

Step-by-Step Solution

1
Identify the service account created by Cloud Logging for the Log Router sink.
The Log Router sink provides a unique service account identifier called a writer identity.
Log Router sinks use service-managed writer identities to authorize cross-project log exports.
2
Assign the minimal required IAM role on the target destination.
The service account gains BigQuery Data Editor access specifically on the target dataset.
This grants the sink permission to write table entries without granting excessive project-level administrative permissions.

Key Concept

Log Router Sink Writer Identity and Cross-Project IAM Configuration
Rate this question