Question

Difficulty: MediumMonitoring and Logging

An operations team needs to monitor custom error codes appearing in container log entries from a Google Kubernetes Engine (GKE) cluster. Whenever the rate of these specific error logs exceeds a critical threshold, the system must trigger an alert that sends notifications to an external incident management platform via an HTTP endpoint. Which TWO actions must the operations team take to configure this solution?

  1. Create a log-based metric in Cloud Logging filtered by the specific container log fields and error patterns.Answer
  2. B
    Install the legacy standalone Monitoring and Logging agents on the GKE worker nodes to parse container stdout into custom metrics.
  3. Configure an alerting policy in Cloud Monitoring that monitors the log-based metric and routes notifications through a Webhook notification channel.Answer
  4. D
    Assign the primitive Project Owner role to the GKE node service account to grant permission to post alert events to external webhooks.

Answer

To alert on specific container log patterns and notify an external HTTP endpoint, you must create a log-based metric in Cloud Logging to extract the count of matching log entries, and then create an Alerting Policy in Cloud Monitoring based on that metric using a Webhook notification channel.
The correct approach requires converting unstructured or structured log events into quantifiable metric data using a Cloud Logging log-based metric. Once the log-based metric is populated in Cloud Monitoring, an Alerting Policy can monitor its rate of occurrence and trigger alerts sent via a Webhook notification channel to external endpoints.

Step-by-Step Solution

1
Define a Log-based Metric in Cloud Logging
Filter container stdout/stderr logs by specific error attributes and convert matching entry frequencies into a numerical metric time-series.
Cloud Monitoring alerting policies require structured metric data to evaluate threshold conditions.
2
Configure Alerting Policy and Notification Channel in Cloud Monitoring
Set up an alerting condition against the log-based metric and link a Webhook notification channel pointing to the incident management platform.
When the metric condition triggers, Cloud Monitoring formats the alert payload and sends an HTTP POST request to the configured webhook URL.

Key Concept

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