Soru

Zorluk: ZorMonitoring and Logging

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.)

  1. 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
  2. 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
  3. C
    Install the legacy Stackdriver Logging agent on the instances and configure a Cloud Monitoring Uptime Check targeting `/var/log/app/error.log` directly.
  4. D
    Grant 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

1
Configure Local Log Ingestion
Local log entries from `/var/log/app/error.log` are parsed and streamed into Cloud Logging.
Cloud Logging must ingest log records before log-based metrics can process log content.
2
Create Log-Based Metric and Alert
A counter log-based metric tracks `CRITICAL` logs, and an alerting policy fires when the rate exceeds 10 entries per minute.
Log-based metrics convert log occurrence frequencies into measurable Cloud Monitoring time-series metrics.

Anahtar Kavram

Log-based metrics and Ops Agent log ingestion for threshold alerting
Bu soruyu puanla