An operations team needs to track the frequency of specific application error messages captured in Google Cloud Logging from Compute Engine instances and receive email notifications whenever the error rate exceeds a defined threshold. Which TWO actions must be performed to fulfill these requirements?
- Create a custom counter log-based metric in Cloud Logging filtered by the specific application error log text.Answer
- Create an alerting policy in Cloud Monitoring conditioned on the log-based metric and attach an email notification channel.Answer
- CAssign the primitive Editor role to the Compute Engine default service account to authorize Cloud Logging metric creation.
- DEnable the Cloud Monitoring API within the Organization Policy constraints editor at the root folder level.
Answer
To track log frequencies and trigger alerts based on log content, you must create a custom counter log-based metric in Cloud Logging matching the log pattern, and then configure an alerting policy in Cloud Monitoring using that metric with an attached email notification channel.
To alert on specific log events in Google Cloud, log entries must first be converted into a metric using Cloud Logging counter log-based metrics. Once the metric exists, Cloud Monitoring can evaluate its values against threshold conditions and send alerts to designated notification channels like email.
Step-by-Step Solution
Key Concept
Log-based metrics and alerting policy integration in Google Cloud Observability