Compute Log Troubleshooting

google/skills/skills/cloud/compute-log-troubleshooting

by googled16c587e1e9a0a88d91b242f7e5f5bbe374e07c8No license25K starsListed Dec 4, 2026Updated Dec 4, 2026Repository updated today

Diagnoses, filters, and resolves in-guest Google Compute Engine virtual machine (VM) OS, boot, agent, storage, and service authorization issues using Cloud Logging, Serial Console output, Cloud Monitoring, gcloud CLI, and MCP tools. Use only when analyzing Compute Engine VM system or application logs, investigating Out-of-Memory (OOM) process kills, full-disk (ENOSPC) or filesystem resize failures, startup-script or systemd unit errors, Ops Agent ingestion failures, or VM service account and OAuth access scope 403 errors. Don't use for creating new VMs (compute-vm-creation), physical host hardware errors (hostError), host maintenance policies or windows, Local SSD recovery timeouts, or Spot preemptions (compute-host-events-troubleshooting), MIG autoscaling (compute-mig-autoscaling-troubleshooting), GKE clusters or Pods, or multi-hop VPC packet-drop and NAT diagnostics (google-cloud-networking-observability).

FeaturedInstructions onlyDevOps & Cloud
AI-generated overview

Diagnoses Google Compute Engine VM guest issues using Cloud Logging, serial console output, Cloud Monitoring and gcloud.

What it does
Guides diagnosis of in-guest Compute Engine VM problems: out-of-memory kills, full disks and resize failures, boot and startup-script errors, Ops Agent ingestion failures, and IAM or OAuth scope 403 errors. It explains which log streams exist by default, how to filter them correctly, and when to fall back to the hypervisor serial buffer. It routes each symptom to a reference playbook and covers verification, rollback of temporary access, cleanup and cost notes.
When to use it
Use when investigating Compute Engine VM system or application logs, OOM kills, ENOSPC or filesystem resize failures, startup-script or systemd errors, Ops Agent ingestion problems, or service account and OAuth scope 403 errors. Not for VM creation, host hardware events, MIG autoscaling, GKE, or VPC packet-drop diagnostics.
Requirements
Requires the gcloud CLI or the Compute Engine, Cloud Logging and Cloud Monitoring MCP servers, plus Google Cloud authentication and IAM viewer roles for diagnostics (broader roles for remediation). Project, zone and time window must be supplied; mutating commands need explicit user approval. Ships no scripts, only reference documents.

How AI overviews are written and checked

Compute Engine VM log troubleshooting and observability

This skill diagnoses and resolves in-guest Google Compute Engine virtual machine (VM) issues across Out-of-Memory (OOM) exhaustion, authorization and OAuth access scope failures, full disks (ENOSPC) and filesystem expansion, and boot, startup script, Ops Agent, and SSH connectivity errors. It encodes the exact Cloud Logging schemas, serial console fallbacks, and hardware and OS nuances where default troubleshooting queries silently return empty results or fail.

MCP Tools: get_instance_basic_info, list_instances, list_instance_attached_disks, get_disk_basic_info, stop_instance, set_instance_machine_type, start_instance, get_zone_operation

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or Model Context Protocol (MCP) command, you MUST read and follow the instructions in Usage Attribution [blocked].

Prerequisites and environment setup

Any command that mutates state requires explicit user approval before execution. For example, get approval before running commands that install gcloud, configure MCP servers, enable APIs, stop or resize VMs, create snapshots, resize disks, update metadata or access scopes, or change Identity and Access Management (IAM) bindings.

  1. Google Cloud CLI (gcloud): Before running gcloud commands in a terminal, run gcloud version to verify the command-line interface (CLI) is installed (skip this when answering conceptual questions or providing copy-pasteable commands only). If gcloud is missing, notify the user that gcloud is required for CLI execution, provide copy-pasteable commands, and ask before installing via Install the gcloud CLI.
  2. Remote MCP servers and capability boundaries: Check whether these MCP tools are already available in your active session before suggesting setup, and ask for user approval before modifying MCP client configuration:
    • Compute Engine (MCP server endpoint: https://compute.googleapis.com/mcp): Configure per Use the Compute Engine MCP server; see Compute Engine MCP reference. For VM troubleshooting, the MCP server exposes tools such as get_instance_basic_info (resolves VM name to numeric id, status, machineType), list_instances, list_instance_attached_disks, get_disk_basic_info, stop_instance, set_instance_machine_type, start_instance, and get_zone_operation (no get_instance or list_zone_operations tools exist). get_instance_basic_info omits serviceAccounts (and OAuth scopes), metadata, networkInterfaces, and scheduling, and Compute Engine has no MCP tools for get-serial-port-output, disks resize, or snapshots create—route those to gcloud or REST.
    • Cloud Logging (MCP server endpoint: https://logging.googleapis.com/mcp): Configure per Use the Cloud Logging remote MCP server; see Cloud Logging MCP reference. The server exposes tools such as list_log_entries and list_log_names (no list_monitored_resource_descriptors tool exists). list_log_entries requires "resourceNames": ["projects/{project_id}"] (never "projects") and supports only one project per call.
    • Cloud Monitoring (MCP server endpoint: https://monitoring.googleapis.com/mcp): Configure per Use the Cloud Monitoring remote MCP server; see Cloud Monitoring MCP reference. The server exposes tools such as list_timeseries, query_range, and list_metric_descriptors (plural—no singular get_metric_descriptor tool).
  3. Authentication: Authenticate via gcloud auth login (CLI), gcloud auth application-default login (Application Default Credentials for SDKs and MCP), or GOOGLE_APPLICATION_CREDENTIALS (service account key or Workload Identity).
  4. Project, region, billing, and API enablement: Ask the user for {project_id}, {region}, and {zone} if not provided. Pass --project and --zone per command for read-only diagnostics, and request user approval before modifying gcloud config defaults or enabling APIs:
    gcloud config set project {project_id}
    gcloud config set compute/region {region}
    gcloud config set compute/zone {zone}
    gcloud services enable compute.googleapis.com logging.googleapis.com monitoring.googleapis.com telemetry.googleapis.com
    Note: Target projects require an active billing account (even when using Google Cloud Free Tier resources). logging.googleapis.com, monitoring.googleapis.com, and telemetry.googleapis.com are typically enabled on new projects (verify telemetry.googleapis.com on existing projects when ingesting OpenTelemetry Protocol (OTLP) telemetry). Always use the existing VM's region and zone; for new test or rescue resources with no location specified, ask for the user's location and select a nearby region from Google Cloud locations (using a broadly supported region such as us-central1 only as an example fallback, noting preview features are often restricted to global or us-central1).
  5. Required IAM roles:
    • Read-only diagnostics: roles/compute.viewer (VM config and get-serial-port-output), roles/logging.viewer (or roles/logging.privateLogViewer for Data Access audit logs), and roles/monitoring.viewer.
    • Remote MCP access: roles/mcp.toolUser (plus roles/logging.admin and roles/monitoring.admin where required by remote Logging and Monitoring OAuth scopes; see the MCP setup guides above).
    • Remediation (after user confirmation): roles/compute.instanceAdmin.v1 (plus roles/iam.serviceAccountUser when updating access scopes or service accounts), resource-scoped IAM admin roles (roles/secretmanager.admin or roles/storage.admin bound on the specific secret or bucket), and project-level roles/resourcemanager.projectIamAdmin only when modifying project-level IAM bindings (such as granting roles/logging.logWriter).

Core diagnostic workflow and empty-logs decision tree

1. Mode-aware intake and constraint handling

  • Conceptual or query-syntax questions: Answer immediately from the rules below without running shell or MCP commands, or blocking on intake prompts.
  • Read-only or "Do not execute" requests: Never invoke terminal or mutating MCP commands when the user asks not to execute commands, declines approval, or works in a read-only environment. Provide copy-pasteable gcloud commands (without --quiet) and valid MCP JSON arguments, and end with an explicit confirmation prompt before the user applies mutating steps.
  • Live troubleshooting missing inputs: If {project_id}, {vm_name} (or numeric {instance_id}), {zone}, or the time window of the issue is missing (see Prerequisite #4), ask the user for the missing details in a single concise turn without probing gcloud config list first: briefly note the main candidate causes for the symptom (such as OOM kills, full boot disk, startup or service crashes, or firewall or SSH blocks), clarify whether to run diagnostics via connected MCP or gcloud tools or provide copy-pasteable gcloud commands, and offer to list VMs via list_instances once {project_id} and {zone} are confirmed.

2. Resolve {vm_name} to numeric {instance_id} and check telemetry state

In Cloud Logging, resource.labels.instance_id on gce_instance stores the numeric VM ID (64-bit integer), not {vm_name}. Filtering resource.labels.instance_id="{vm_name}" silently returns zero entries. Always resolve {instance_id} and inspect disk interfaces (NVME vs. SCSI), serviceAccounts[].scopes, and serial-port-logging-enable metadata first:

gcloud compute instances describe {vm_name} --project={project_id} --zone={zone} \
    --format="yaml(id, status, machineType.basename(), disks, serviceAccounts, metadata.items, networkInterfaces)"

For lightweight MCP discovery when only id, status, and machineType are needed, call get_instance_basic_info with {"project": "{project_id}", "zone": "{zone}", "name": "{vm_name}"} and list_instance_attached_disks.

3. Compute Engine log stream reference (why queries return 0 rows)

By default, Compute Engine VMs send neither guest OS logs (syslog) nor serial console logs to Cloud Logging. Use this matrix to identify which log streams are enabled by default, how to filter each stream, and when to fall back to the live hypervisor serial buffer:

Log StreamEnabled by Default?Exact resource.type & log_id or CommandVM Identifier FilterDefault Severity & Filtering Notes
Control-Plane & Host Audit LogsYesresource.type="gce_instance" + log_id("cloudaudit.googleapis.com/activity") or log_id("cloudaudit.googleapis.com/system_event")resource.labels.instance_id="{instance_id}" or protoPayload.resourceName:"{vm_name}"system_event entries (hostError, migrateOnHostMaintenance, guestTerminate, preempted) log at INFO and route to _Required (not _Default). Delegate deep host-event recovery to compute-host-events-troubleshooting.
Guest OS & App Logs (Ops Agent)No (Requires Ops Agent + roles/logging.logWriter)resource.type="gce_instance" + log_id("syslog") (Linux) or log_id("windows_event_log") (Windows)resource.labels.instance_id="{instance_id}" or labels."compute.googleapis.com/resource_name"="{vm_name}"Default Linux pipeline writes to syslog (not journald). If the disk hits 100% full, OOM kills the agent, or IAM logWriter is missing, final crash logs never reach Cloud Logging.
Serial Console in Cloud LoggingNo (Requires serial-port-logging-enable=true metadata)resource.type="gce_instance" + log_id("serialconsole.googleapis.com/serial_port_1_output")resource.labels.instance_id="{instance_id}"Ingested at INFO or DEFAULT even for kernel panics and OOM kills—never add severity>=ERROR or severity>=ALERT, which filters out every serial log line.
Live Hypervisor Serial Ring BufferYes (Last 1 MB on running VMs; no metadata needed)gcloud compute instances get-serial-port-output {vm_name} --project={project_id} --zone={zone} --port=1{vm_name} + --zone={zone}Primary fallback when Cloud Logging is empty or SSH is unreachable. Captures kernel panics, OOM kills, google_metadata_script_runner, and full-disk boot errors directly from the hypervisor.
VPC Firewall Rules LoggingNo (Opt-in per firewall rule via --enable-logging)resource.type="gce_subnetwork" + log_id("compute.googleapis.com/firewall")jsonPayload.instance.vm_name="{vm_name}"Uses gce_subnetwork (never gce_instance), severity=DEFAULT, and jsonPayload.disposition="DENIED" (never "DROPPED"). VPC Flow Logs (vpc_flows) do not capture ingress packets denied by firewall rules.

4. Apply explicit time bounds (--freshness vs. timestamp>=)

Consult Logging query language for filter syntax details and apply explicit time bounds on every query:

  • gcloud logging read default 24-hour window: gcloud logging read defaults to --freshness=1d and silently excludes log entries older than 24 hours. Always pass --freshness=7d (or explicit RFC 3339 bounds timestamp>="{start_time}" AND timestamp<="{end_time}" computed from the target time window—never hardcode static example dates).
  • Cloud Logging list_log_entries: Has no default 24-hour bound. Always include timestamp>="{start_time}", "orderBy": "timestamp desc", and a bounded "pageSize" (for example, 20) to prevent slow multi-day scans and timeouts. Standard entries.list queries do not charge per byte scanned; scan charges apply only to BigQuery queries on linked datasets.

5. Correlate hypervisor vs. Ops Agent metrics

  • Built-in hypervisor metrics (compute.googleapis.com/instance/*): Always available without an agent—check compute.googleapis.com/instance/cpu/utilization, disk/read_bytes_count, disk/write_bytes_count, and network/received_bytes_count via Cloud Monitoring's list_timeseries or query_range tools. For E2 VMs only, built-in GA hypervisor balloon metrics also expose RAM and swap without Ops Agent (compute.googleapis.com/instance/memory/balloon/ram_size, ram_used, swap_in_bytes_count, and swap_out_bytes_count).
  • Guest RAM, swap, and filesystem metrics (agent.googleapis.com/*): Required on non-E2 VMs for guest RAM and swap—and on all VMs for filesystem utilization—via the Ops Agent (see Install the Ops Agent).
    • agent.googleapis.com/memory/percent_used emits five separate state series (buffered, cached, free, slab, used): filter with metric.labels.state = "used" to isolate active non-cache process memory during Linux OOM diagnosis (state != "free" includes reclaimable Linux page cache, which is routinely 90–99% on healthy VMs, and returns multiple unaggregated series unless reduced). Also check agent.googleapis.com/swap/percent_used for swap pressure.
    • agent.googleapis.com/disk/percent_used emits three state series (free, used, reserved): inspect state = "free" (or aggregate used plus reserved) to measure available filesystem headroom.

Diagnostic and remediation playbooks

MUST READ: Before diagnosing or remediating a specific symptom, read the matching playbook in references/:

SymptomPlaybook reference
Memory exhaustion, Linux OOM killer, process crashes, or VM memory right-sizingOOM and memory exhaustion [blocked]
Missing IAM permissions, legacy OAuth scopes, Secret Manager or Cloud Storage 403s, or Ops Agent ingestion failuresIAM, OAuth scopes, and Ops Agent 403s [blocked]
Full boot or data disk (No space left on device, ENOSPC), snapshot backups, Hyperdisk or Persistent Disk resize, or partition expansionDisk space exhaustion and resizing [blocked]
Boot errors, startup script failures, unreachable SSH, serial console modes, or VPC Firewall Rules Logging blocksBoot, startup scripts, SSH, and firewall triage [blocked]

Verification, rollback, cleanup, and cost governance

  1. Verify recovery: Confirm instance state (RUNNING), clean serial console tail (get-serial-port-output), restored disk headroom (df -Th and df -i), and fresh telemetry in Cloud Logging and Cloud Monitoring.
  2. Rollback temporary interactive serial access: If serial-port-enable=TRUE was temporarily enabled for emergency login, disable it immediately:
    gcloud compute instances add-metadata {vm_name} --project={project_id} \
        --zone={zone} --metadata=serial-port-enable=FALSE
  3. Clean up temporary snapshots and rescue resources: Once disk and OS stability are verified, delete temporary pre-resize snapshots or rescue VMs so storage charges do not accumulate (omit --quiet on manual delete commands so interactive confirmation prevents accidental data loss):
    gcloud compute snapshots delete {snapshot_name} --project={project_id}
    gcloud compute instances delete {rescue_vm_name} --project={project_id} --zone={zone} --delete-disks=all
  4. Pricing reference: Point users to Google Cloud Observability pricing, Compute Engine pricing, and Google Cloud pricing rather than quoting hardcoded dollar rates (Cloud Logging charges depend on log storage volume and retention settings, while resized disks and retained snapshots incur ongoing storage charges until deleted).

Source and attribution

Source:google/skillsinskills/cloud/compute-log-troubleshootingat commitd16c587

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Add a badge to your README

Show readers this skill is listed on SourceWeft. The badge links to this page.

Preview of the “Listed on SourceWeft” badge
[![Listed on SourceWeft](https://sourceweft.com/badge/skills/gh-google-skills-compute-log-troubleshooting-skills-cloud-compute-log-troubleshooting-989787a8a6ff4a10.svg)](https://sourceweft.com/skills/gh-google-skills-compute-log-troubleshooting-skills-cloud-compute-log-troubleshooting-989787a8a6ff4a10?utm_source=readme&utm_medium=badge)

Report or request removal