An application developer needs to receive an automated email notification whenever a specific error code string appears in the log stream of a Google Cloud application. What is the Google-recommended method to accomplish this requirement?
- Create a log-based counter metric matching the error string filter, and create a Cloud Monitoring alerting policy based on that metric with an email notification channel.Cevap
- BInstall the legacy Stackdriver Logging Agent on the instance host and configure a custom script to forward log files directly to a Pub/Sub topic for email delivery.
- CAssign the Primitive Owner role to the developer account so Cloud Logging automatically triggers email alerts for all application logs containing errors.
- DEnable the Cloud Monitoring API at the organization node level and enforce an Organization Policy constraint that forwards matching logs to email.
Cevap
Create a log-based counter metric matching the error string filter, and create a Cloud Monitoring alerting policy based on that metric with an email notification channel.
The standard solution in Google Cloud Observability for alerting on specific log contents is to define a log-based counter metric based on a Cloud Logging filter query, then attach a Cloud Monitoring alerting policy with an email notification channel to that metric.
Adım Adım Çözüm
Anahtar Kavram
Log-based Metrics and Alerting Policies
Tahmini Süre:50s