An operations engineering team is setting up real-time operational monitoring for a web application hosted on Google Cloud. The team needs to track HTTP 500 internal server error occurrences logged by the web server and automatically trigger incident alerts whenever the error count exceeds 50 occurrences within a 5-minute rolling window. Which TWO actions must be configured to achieve this operational observability setup? (Select TWO.)
- Create a counter log-based metric in Cloud Logging filtered by log entries matching severity level ERROR and HTTP response status code 500.Answer
- Create an alerting policy in Cloud Monitoring conditioned on the custom log-based metric exceeding a threshold of 50 over a 5-minute alignment period.Answer
- CAssign the primitive Owner role (roles/owner) to the project service account so Cloud Logging can export custom metric data into Cloud Monitoring.
- DGrant the Service Account Admin role (roles/iam.serviceAccountAdmin) to the operations engineer configuring the alerting policies.
- EConfigure an aggregate log exclusion filter matching HTTP status code 500 to optimize ingestion quotas before metric extraction.
Answer
To configure real-time error alerting based on application log events, you must create a counter log-based metric in Cloud Logging filtered for HTTP 500 error logs, and then configure a Cloud Monitoring alerting policy that monitors this log-based metric against the threshold of 50 errors per 5 minutes.
Defining a counter log-based metric in Cloud Logging allows specific log event criteria (HTTP 500 errors) to be tracked as numerical time-series data. Setting up a Cloud Monitoring alerting policy conditioned on this metric threshold enables automated incident alerts when the error threshold is breached within the specified 5-minute window.
Step-by-Step Solution
Key Concept
Log-based Metrics and Operational Alerting in Google Cloud Observability