Question

Difficulty: MediumConfiguring Cloud Logging, Monitoring, and Operational Alerting

A DevOps engineering team is operating a microservices application deployed on Cloud Run. During peak usage, transient database connectivity issues generate log entries containing the structured field payload status: CRITICAL_DATABASE_TIMEOUT. The team needs to configure automated alerting to notify on-call engineers via an existing Cloud Monitoring notification channel whenever this log entry appears more than 10 times within any 5-minute rolling window. Which configuration should the team implement?

  1. Create a counter log-based metric in Cloud Logging filtered for the database timeout log payload, and configure a Cloud Monitoring alerting policy based on this metric using a 5-minute rolling alignment window.Answer
  2. B
    Configure an exclusion filter in Cloud Logging for the timeout log payload, and attach the PagerDuty notification channel directly to the exclusion filter definition.
  3. C
    Assign the primitive Owner role (roles/owner) to the application service account so Cloud Logging automatically elevates matching log entries to high-priority operational incidents.
  4. D
    Submit a regional quota increase request for Cloud Logging log ingestion capacity before creating log routing pipelines.

Answer

Create a counter log-based metric in Cloud Logging filtered for the database timeout log payload, and configure a Cloud Monitoring alerting policy based on this metric using a 5-minute rolling alignment window.
Creating a counter log-based metric allows Cloud Logging to count occurrence instances of specific log entries matching a filter. Cloud Monitoring reads this metric and evaluates threshold conditions over specified time windows (such as 5 minutes) to trigger alerting policies and push notifications to operational channels.

Step-by-Step Solution

1
Define a counter log-based metric in Cloud Logging
Cloud Logging starts counting matching log entries containing status: CRITICAL_DATABASE_TIMEOUT as time-series metric data points.
Log-based metrics convert unstructured or structured log event frequencies into numerical metrics accessible by Cloud Monitoring.
2
Create an alerting policy in Cloud Monitoring
An alerting policy condition monitors the log-based metric with a 5-minute alignment period and a threshold of > 10 occurrences.
Cloud Monitoring aggregation functions compute the rate of occurrence over the specified time window.
3
Attach the notification channel to the alerting policy
When the threshold is breached, Cloud Monitoring automatically sends an operational alert to the on-call team.
Notification channels route incident alerts to external operations systems like PagerDuty or Slack.

Key Concept

Log-based Metrics and Cloud Monitoring Alert Policies
Estimated Time:1m 30s
Rate this question