nerdexam
Google

PROFESSIONAL-CLOUD-DEVOPS-ENGINEER · Question #163

You are configuring Cloud Logging for a new application that runs on a Compute Engine instance with a public IP address. A user-managed service account is attached to the instance. You confirmed…

The correct answer is C. Add the Logs Writer role to the service account. If logs from a Compute Engine instance are not appearing in Cloud Logging despite agents running, the user-managed service account attached to the instance likely lacks the necessary Logs Writer role to send logs.

Submitted by fatima_kr· Apr 18, 2026Implementing service monitoring strategies

Question

You are configuring Cloud Logging for a new application that runs on a Compute Engine instance with a public IP address. A user-managed service account is attached to the instance. You confirmed that the necessary agents are running on the instance but you cannot see any log entries from the instance in Cloud Logging. You want to resolve the issue by following Google- recommended practices. What should you do?

Options

  • AExport the service account key and configure the agents to use the key.
  • BUpdate the instance to use the default Compute Engine service account.
  • CAdd the Logs Writer role to the service account.
  • DEnable Private Google Access on the subnet that the instance is in.

How the community answered

(65 responses)
  • A
    6% (4)
  • B
    14% (9)
  • C
    77% (50)
  • D
    3% (2)

Why each option

If logs from a Compute Engine instance are not appearing in Cloud Logging despite agents running, the user-managed service account attached to the instance likely lacks the necessary Logs Writer role to send logs.

AExport the service account key and configure the agents to use the key.

Exporting service account keys is a security anti-pattern and not recommended for authentication within GCP, as instance service accounts are designed to provide credentials automatically.

BUpdate the instance to use the default Compute Engine service account.

While the default Compute Engine service account often has broad permissions, it's a general practice to use custom service accounts with the principle of least privilege, so this is not the recommended first step.

CAdd the Logs Writer role to the service account.Correct

For an application or agent running on a Compute Engine instance to write logs to Cloud Logging, the service account associated with that instance must have the `roles/logging.logWriter` IAM role. This role grants the permissions required to create log entries in Cloud Logging, ensuring that logs emitted by the agents can be successfully ingested and displayed.

DEnable Private Google Access on the subnet that the instance is in.

Private Google Access is for instances without external IP addresses to reach Google APIs over internal IP addresses; since the instance has a public IP, this setting is irrelevant to the logging issue.

Concept tested: Cloud Logging IAM permissions for Compute Engine

Source: https://cloud.google.com/logging/docs/agent/installation#before-you-begin

Topics

#Cloud Logging#IAM#Service Accounts#Compute Engine

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Practice