Skip to main content

Build

Compute Log Troubleshooting

Google Cloud SkillsOfficialCertified

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

  • New
  • v1.0.0
  • Reviewed Dec 5
  • No reviews yet

Capabilities

  • Usage Attribution

    Before executing any gcloud, REST API, or Model Context

  • Diagnostic and remediation playbooks

    Before diagnosing or remediating a specific symptom, read the

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.0.0

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.

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:
    bash
    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:

bash
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 Stream Enabled by Default? Exact resource.type & log_id or Command VM Identifier Filter Default Severity & Filtering Notes
Control-Plane & Host Audit Logs Yes resource.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 Logging No (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 Buffer Yes (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 Logging No (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/:

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

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

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from Google Cloud Skills

View source →
migrate-to-rustClones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across…9 installsspanner-basicsAssists in provisioning instances and databases, designing performant schemas, and querying data in Cloud Spanner on Google Cloud. Use when designing primary keys, writing SQL queries or client library code, or diagnosing performance…4 installsgoogle-ads-api-mcp-setupGuides developers through downloading, configuring, and installing the official open-source Google Ads MCP Server. Use this skill when a user wants to connect their AI assistant (such as Gemini, Claude Code, or Cursor) to their Google Ads…4 installsgke-workload-securityAudits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2…3 installsgke-manifest-generationGenerates and updates secure, production-ready Kubernetes YAML manifests optimized for GKE Autopilot and GKE Standard clusters. Use when creating or modifying GKE deployment manifests, configuring container security contexts, setting…2 installsgoogle-cloud-recipe-networking-observabilityInvestigates Google Cloud networking issues by analyzing logs, metrics, and diagnostics. Use when investigating VPC Flow Logs, NAT, firewall, or threat logs, querying latency and throughput metrics, or running Connectivity Tests for path…2 installs

Frequently asked questions about compute-log-troubleshooting

What does the compute-log-troubleshooting skill do?

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). It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the compute-log-troubleshooting skill?

Run `npx @skills-hub-ai/cli install google-cloud-skills-compute-log-troubleshooting` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/google-cloud-skills-compute-log-troubleshooting/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does compute-log-troubleshooting work with?

compute-log-troubleshooting runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the compute-log-troubleshooting skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use compute-log-troubleshooting after installing it?

In Claude Code, type `/google-cloud-skills-compute-log-troubleshooting` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the compute-log-troubleshooting skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/google-cloud-skills-compute-log-troubleshooting)](https://skills-hub.ai/skills/google-cloud-skills-compute-log-troubleshooting)
HTML
<a href="https://skills-hub.ai/skills/google-cloud-skills-compute-log-troubleshooting"><img src="https://skills-hub.ai/api/badges/skill/google-cloud-skills-compute-log-troubleshooting" alt="Install on Skills Hub"></a>

More options in the badge docs.