Question

Difficulty: HardMonitoring and Logging

A Cloud Engineer must set up telemetry collection for a fleet of Linux-based Compute Engine virtual machines. The requirements state that custom application log files must be ingested into Cloud Logging, and system-level performance metrics (such as memory utilization and disk space usage) must be reported to Cloud Monitoring. Access permissions must strictly adhere to the principle of least privilege. Which TWO actions should the engineer take to achieve this configuration? (Select TWO.)

  1. Install and configure the unified Google Cloud Ops Agent on each Compute Engine instance.Answer
  2. Grant the Logs Writer (roles/logging.logWriter) and Monitoring Metric Writer (roles/monitoring.metricWriter) predefined roles to the VM instance service account.Answer
  3. C
    Install the legacy Stackdriver Monitoring Agent alongside the legacy Stackdriver Logging Agent on all Compute Engine instances.
  4. D
    Grant the primitive Editor (roles/editor) role to the default Compute Engine service account.

Answer

To collect system-level memory metrics alongside custom application logs while enforcing least privilege, the engineer must install the unified Google Cloud Ops Agent on the virtual machines and grant the service account attached to the instances the Logs Writer (roles/logging.logWriter) and Monitoring Metric Writer (roles/monitoring.metricWriter) predefined roles.
Installing the Google Cloud Ops Agent is the Google-recommended approach for gathering both system metrics (like memory) and application log files from Compute Engine VMs. Combining this agent deployment with targeted predefined roles (roles/logging.logWriter and roles/monitoring.metricWriter) ensures the VM service account has only the permissions required to send observability data to Google Cloud.

Step-by-Step Solution

1
Deploy the unified telemetry agent.
Install Google Cloud Ops Agent on the VM instances to collect both logs and extended system metrics.
The Ops Agent replaces legacy Stackdriver agents and provides support for memory metrics and custom log file tracking.
2
Configure IAM permissions according to least privilege.
Attach predefined roles/logging.logWriter and roles/monitoring.metricWriter to the VM service account.
These predefined roles allow ingestion of telemetry data without granting excessive project administrative rights.

Key Concept

Google Cloud Ops Agent configuration and least-privilege IAM telemetry roles
Rate this question