A Cloud Engineer is managing a fleet of Compute Engine virtual machine instances running a custom application. The application writes application-level error records to a local log file at `/var/log/app/error.log`. The SRE team requires automated Cloud Monitoring notifications to trigger whenever the rate of `CRITICAL` status log entries in this file exceeds 10 per minute. Which TWO operational steps must be performed to meet these telemetry and alerting requirements? (Select TWO.)
- Configure the Google Cloud Ops Agent on the Compute Engine instances to collect logs from `/var/log/app/error.log` and ingest them into Cloud Logging.Cevap
- Create a counter log-based metric in Cloud Logging filtered for `CRITICAL` log entries, and define a Cloud Monitoring alerting policy based on this metric.Cevap
- CInstall the legacy Stackdriver Logging agent on the instances and configure a Cloud Monitoring Uptime Check targeting `/var/log/app/error.log` directly.
- DGrant the primitive Owner role (`roles/owner`) to the default Compute Engine service account so the instances can automatically create alerting policies upon log ingestion.
Cevap
The correct steps are configuring the Google Cloud Ops Agent to ingest local log files into Cloud Logging, and creating a counter log-based metric paired with a Cloud Monitoring alerting policy.
To create alerts based on specific text within a local VM log file, the entries must first be ingested into Cloud Logging using the Google Cloud Ops Agent. Once ingested, a counter log-based metric is configured to count matching log occurrences, enabling Cloud Monitoring alerting policies to trigger when the rate crosses defined thresholds.
Adım Adım Çözüm
Anahtar Kavram
Log-based metrics and Ops Agent log ingestion for threshold alerting