Question

Difficulty: HardConfiguring Cloud Logging, Monitoring, and Operational Alerting

An operations engineering team needs to set up automated alerting for unexpected HTTP 500 application error rates occurring in a Cloud Run service. The team wants to track these errors using a custom log-based metric and send real-time alerts to a dedicated Webhook notification channel. What is the correct sequence of steps to configure this logging, metric, and alerting pipeline?

  1. 1Define a custom counter metric in Cloud Logging with a filter matching the Cloud Run resource type and HTTP status code 500.
  2. 2Configure and verify the Webhook notification channel in Cloud Monitoring settings.
  3. 3Create an alerting policy in Cloud Monitoring configured with a threshold condition monitoring the rate of the custom log-based metric.
  4. 4Attach the Webhook notification channel to the alerting policy and enable the policy.

Answer

The operational pipeline must be built logically from metric creation to alert delivery: first, create the custom log-based counter metric in Cloud Logging filtering for HTTP 500 logs; second, set up and verify the target Webhook notification channel in Cloud Monitoring; third, create the alerting policy targeting the log-based metric threshold; finally, attach the notification channel to the alerting policy and activate it.
Configuring operational alerting on log data requires a strict dependency sequence. First, the log entry pattern must be captured as a custom metric in Cloud Logging. Next, the target notification endpoint (Webhook) must be registered in Cloud Monitoring. Third, the alerting policy rule must be created using the metric time series as its condition source. Finally, the notification channel is linked to the policy to finalize alert delivery.

Step-by-Step Solution

1
Create the custom log-based counter metric in Cloud Logging using filter parameters for resource.type="cloud_run_revision" AND httpRequest.status=500.
Cloud Logging creates a metric descriptor and starts extracting time-series metric data into Cloud Monitoring whenever matching logs arrive.
Cloud Monitoring alerting policies cannot reference a log-based metric until the metric descriptor has been created in Cloud Logging.
2
Navigate to Cloud Monitoring Notification Channels and create a new Webhook endpoint channel.
A valid notification channel object is provisioned and available within the workspace.
Notification channels must be defined prior to assigning them to policy notification targets.
3
Define an alerting policy in Cloud Monitoring that monitors the rate of change or count of the custom log-based metric against a specific threshold.
The monitoring policy logic is established to evaluate incoming time-series points.
The policy defines when an incident is opened based on metric evaluation.
4
Bind the Webhook notification channel to the alerting policy and set the policy state to enabled.
The end-to-end logging, monitoring, and operational alerting pipeline is fully operational.
Linking the channel enables active incident routing upon threshold breaches.

Key Concept

Log-based metric and alerting policy configuration workflow in Google Cloud Observability
Rate this question