A Lead Site Reliability Engineer is designing a cross-project telemetry pipeline in Google Cloud. The architecture requires routing all IAM audit logs from a workload project (`proj-app-prod`) to a centralized security project (`proj-sec-analytics`) into a BigQuery dataset. Additionally, any unauthorized IAM policy modification attempt logged in `proj-app-prod` must trigger an immediate email notification via Cloud Monitoring. Which TWO of the following operational steps are required to implement this centralized logging and alerting architecture following Google Cloud best practices?
- Create a Cloud Logging export sink in `proj-app-prod` with an inclusion filter for audit logs targeting the BigQuery dataset in `proj-sec-analytics`, and grant the sink's unique writer identity service account the BigQuery Data Editor role on the destination dataset.Cevap
- Define a custom log-based counter metric in `proj-app-prod` that matches log entries for IAM policy changes, and create a Cloud Monitoring alerting policy condition based on this metric attached to a notification channel.Cevap
- CGrant the primitive Owner role on `proj-sec-analytics` to the default Compute Engine service account of `proj-app-prod` to bypass individual destination permissions for log routing.
- DEnable the legacy Stackdriver Logging API in `proj-sec-analytics` and install the legacy `stackdriver-log-collector` agent on all virtual machine instances to handle cross-project log delivery.
Cevap
Centralized audit log export requires creating a Cloud Logging sink in the source project targeting the destination BigQuery dataset in the central security project, followed by granting the sink's writer identity service account the BigQuery Data Editor role on the target dataset. For real-time alerting on specific log events, a custom log-based metric must be defined for matching log entries, and a Cloud Monitoring alerting policy must be configured using that metric.
To export logs across projects, Cloud Logging relies on Log Router sinks. When a sink is created with a destination in another project, GCP generates a unique writer identity service account for that sink. That specific service account must be granted the appropriate predefined role (such as BigQuery Data Editor) on the target resource. Furthermore, to alert on specific log event patterns like IAM modifications, a log-based metric must be created to convert matching log entries into time-series metric data, which can then be monitored by Cloud Monitoring alerting policies.
Adım Adım Çözüm
Anahtar Kavram
Cross-Project Log Routing & Log-Based Metrics Alerting