Question

Difficulty: MediumMonitoring and Logging

An operations team has created a log-based metric in Google Cloud Logging to measure HTTP 5xx response counts for an application deployed on Cloud Run. The team needs to ensure on-call engineers receive immediate automated alerts via a webhook when the rate of 5xx errors breaches a specific operational threshold. Which action should the cloud engineer take to complete this configuration?

  1. Create an alerting policy in Cloud Monitoring conditioned on the log-based metric and attach a webhook notification channel to it.Answer
  2. B
    Install the legacy Stackdriver Logging agent onto the Cloud Run container instances to stream metric data directly to the webhook endpoint.
  3. C
    Grant the primitive Owner role to the default Cloud Monitoring service account to allow external webhook notifications to execute.
  4. D
    Enable the Cloud Monitoring API at the parent organization node level rather than inside the Cloud Run application project.

Answer

Create an alerting policy in Cloud Monitoring conditioned on the log-based metric and attach a webhook notification channel to it.
To send real-time alerts based on a log-based metric, you must define an alerting policy in Cloud Monitoring that monitors the metric condition and routes notifications to a configured webhook channel.

Step-by-Step Solution

1
Identify the existing telemetry source
The log-based metric is already capturing 5xx error events from Cloud Run logs in Cloud Logging.
Log-based metrics extract numerical data from log entries and expose them as custom metrics in Cloud Monitoring.
2
Define threshold conditions and notification target
An alerting policy is configured to monitor the rate of the log-based metric against the target threshold.
Cloud Monitoring alerting policies evaluate metric values over specified alignment windows and trigger incidents when conditions are violated.
3
Bind the notification channel
The webhook notification channel receives automated payloads whenever an alert incident is opened or closed.
Notification channels specify where Cloud Monitoring routes incident alerts.

Key Concept

Cloud Monitoring Alerting Policies and Log-Based Metrics Integration
Estimated Time:1m 30s
Rate this question