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).
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 instructionsInstall 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.
- Google Cloud CLI (
gcloud): Before runninggcloudcommands in a
terminal, rungcloud versionto verify the command-line interface (CLI) is
installed (skip this when answering conceptual questions or providing
copy-pasteable commands only). Ifgcloudis missing, notify the user that
gcloudis required for CLI execution, provide copy-pasteable commands, and
ask before installing via
Install the gcloud CLI. - 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 VMnameto numericid,status,
machineType),list_instances,list_instance_attached_disks,
get_disk_basic_info,stop_instance,set_instance_machine_type,
start_instance, andget_zone_operation(noget_instanceor
list_zone_operationstools exist).get_instance_basic_infoomits
serviceAccounts(and OAuthscopes),metadata,networkInterfaces,
andscheduling, and Compute Engine has no MCP tools for
get-serial-port-output,disks resize, orsnapshots create—route those
togcloudor 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 aslist_log_entriesandlist_log_names
(nolist_monitored_resource_descriptorstool 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 aslist_timeseries,query_range, and
list_metric_descriptors(plural—no singularget_metric_descriptor
tool).
- Compute Engine (MCP server endpoint:
- Authentication: Authenticate via
gcloud auth login(CLI),
gcloud auth application-default login(Application Default Credentials for
SDKs and MCP), orGOOGLE_APPLICATION_CREDENTIALS(service account key or
Workload Identity). - Project, region, billing, and API enablement: Ask the user for
{project_id},{region}, and{zone}if not provided. Pass--project
and--zoneper command for read-only diagnostics, and request user approval
before modifyinggcloudconfig defaults or enabling APIs:Note: Target projects require an active billing account (even when usingbashgcloud 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
Google Cloud Free Tier
resources).logging.googleapis.com,monitoring.googleapis.com, and
telemetry.googleapis.comare typically enabled on new projects (verify
telemetry.googleapis.comon 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 asus-central1only as an example fallback,
noting preview features are often restricted toglobalorus-central1). - Required IAM roles:
- Read-only diagnostics:
roles/compute.viewer(VM config and
get-serial-port-output),roles/logging.viewer(or
roles/logging.privateLogViewerfor Data Access audit logs), and
roles/monitoring.viewer. - Remote MCP access:
roles/mcp.toolUser(plusroles/logging.adminand
roles/monitoring.adminwhere required by remote Logging and Monitoring
OAuth scopes; see the MCP setup guides above). - Remediation (after user confirmation):
roles/compute.instanceAdmin.v1
(plusroles/iam.serviceAccountUserwhen updating access scopes or service
accounts), resource-scoped IAM admin roles (roles/secretmanager.adminor
roles/storage.adminbound on the specific secret or bucket), and
project-levelroles/resourcemanager.projectIamAdminonly when modifying
project-level IAM bindings (such as grantingroles/logging.logWriter).
- Read-only diagnostics:
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-pasteablegcloud
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 probinggcloud config listfirst: 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 orgcloudtools or provide
copy-pasteablegcloudcommands, and offer to list VMs vialist_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 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 readdefault 24-hour window:gcloud logging read
defaults to--freshness=1dand 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
includetimestamp>="{start_time}","orderBy": "timestamp desc", and a
bounded"pageSize"(for example,20) to prevent slow multi-day scans and
timeouts. Standardentries.listqueries 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, andnetwork/received_bytes_countvia Cloud
Monitoring'slist_timeseriesorquery_rangetools. ForE2VMs 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, andswap_out_bytes_count). - Guest RAM, swap, and filesystem metrics (
agent.googleapis.com/*):
Required on non-E2VMs 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_usedemits five separatestate
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_usedfor swap pressure.agent.googleapis.com/disk/percent_usedemits threestateseries (free,
used,reserved): inspectstate = "free"(or aggregateusedplus
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
- Verify recovery: Confirm instance state (
RUNNING), clean serial console
tail (get-serial-port-output), restored disk headroom (df -Thand
df -i), and fresh telemetry in Cloud Logging and Cloud Monitoring. - Rollback temporary interactive serial access: If
serial-port-enable=TRUEwas temporarily enabled for emergency login,
disable it immediately:bashgcloud compute instances add-metadata {vm_name} --project={project_id} \ --zone={zone} --metadata=serial-port-enable=FALSE - 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--quieton manualdelete
commands so interactive confirmation prevents accidental data loss):bashgcloud compute snapshots delete {snapshot_name} --project={project_id} gcloud compute instances delete {rescue_vm_name} --project={project_id} --zone={zone} --delete-disks=all - 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- Gke UpgradesPlans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both…
- Google Cloud Storage Bucket ArchitectCreates Cloud Storage on Google Cloud (also known colloquially as GCS) buckets. Analyzes the workload (sensitive data,…
- Google Cloud Solution Rag Enterprise Search Gke SqldbDiscovers requirements, and generates architectural, design, and deployment guidance for a retrieval-augmented…
- Gke Cost OptimizationOptimizes GKE costs, rightsizes workloads, and configures Spot VMs, CUDs, cost allocation, and resource quotas. Use…
- Firebase BasicsProvides foundational Firebase CLI setup, CLI installation, version checks (`firebase-tools@latest --version`), CLI…
- Google Analytics Admin API BasicsManages Google Analytics account and property settings, enables the Analytics Admin API via the Cloud CLI, lists…
Security
Reviews (0)
More from Google Cloud Skills
View source →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.
[](https://skills-hub.ai/skills/google-cloud-skills-compute-log-troubleshooting)<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.