Courseiva

Google PCA Cloud Logging Practice Question

An application running on Compute Engine is experiencing increased latency. You suspect a network bottleneck due to high egress traffic. Which gcloud command can you use to quickly check the network egress traffic for a specific VM instance?

⚠ Common exam trap

Students may think that Cloud Monitoring is the only way to view metrics, but Cloud Logging can also be used to query specific data like egress bytes if logs are collected. They might also incorrectly choose D because monitoring sounds relevant, but the command 'gcloud monitoring metrics list' only lists metric descriptors, not actual data.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

gcloud logging read 'resource.type=gce_instance AND jsonPayload.egress_bytes'

The gcloud logging read command allows you to query Cloud Logging for specific log entries. For a Compute Engine instance, the resource type is gce_instance. You can filter for egress bytes by using the query 'resource.type=gce_instance AND jsonPayload.egress_bytes'. This will return log entries containing egress bytes information, assuming your VM is configured to send these logs (e.g., via the monitoring agent or VPC flow logs). This is the quickest way among the given options to check network egress traffic for a specific VM using a native gcloud command. Option B is incorrect: gcloud compute instances list only displays the network IP of instances, not egress traffic metrics. Option C is incorrect: gcloud compute instances get-serial-port-output shows the serial console output, which does not include network traffic data. Option D is incorrect: gcloud monitoring metrics list just lists available metrics but does not retrieve the actual traffic data for a specific instance. To get the data you would need to use gcloud monitoring metric descriptors or gcloud monitoring dashboards, but the command as given does not return traffic. Thus, A is the best choice.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • gcloud logging read 'resource.type=gce_instance AND jsonPayload.egress_bytes'

    Why this is correct

    gcloud logging read with the specified filter queries Cloud Logging for egress bytes logs from Compute Engine instances, making it the correct choice.

  • gcloud compute instances list --format='value(networkInterfaces[0].networkIP)'

    Why it's wrong here

    gcloud compute instances list only shows the network IP of instances, not egress traffic.

  • gcloud compute instances get-serial-port-output

    Why it's wrong here

    gcloud compute instances get-serial-port-output displays serial console output, not network traffic.

  • gcloud monitoring metrics list

    Why it's wrong here

    gcloud monitoring metrics list lists available metric descriptors but does not retrieve actual traffic data.

Visual reference

Source Router + ACL permit 10.0.0.0/8 deny any Server 10.0.0.5 ✓ 192.168.1.1 ✗ dropped ACLs evaluate top-down; first match wins — implicit deny all at end

Go deeper

Related to this question

About these practice questions

This PCA question is part of Courseiva's 955-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCA practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCA exam.