Collecting diagnostic information Stay organized with collections Save and categorize content based on your preferences.
This document describes how to collect information about a virtual machine (VM)instance by using a diagnostic tool. Use the information that the tools collectsto help with basic troubleshooting before contactingSupport.
The tool does the following:
Collects information only from the VM that you specify.
Stores the information only in your project.
Stores the information for 10 days in aCloud Storagebucket, which, by default, only you can access.
Before sharing the collected information with Google Support, do the following:
Review the information for confidential or personally identifiableinformation (PII).
Delete or mask the information as necessary.
Diagnostic information collected from the VM
This diagnostic tool collects information about the following:
Disks:
- Windows Management Instrumentation(WMI) object information aboutdisks,partitions, andvolumes
Events:
- Windows Events, including application events and system events
Networks:
Programs:
- WMI object information aboutprocesses,scheduled tasks,services, andGoogle Kubernetes Engine (GKE)
System:
- WMI object information aboutusers, Remote Desktop Protocol (RDP) settings by usingthis script, and output frombcdedit,driverquery,msinfo32,pnputil, andsysteminfo, andmemory dump logs
For detailed information about how Compute Engine collects thisinformation, see thepublic repository.
Limitations
- You can only collect diagnostic information from VMs created based on WindowsServer.
Before you begin
- Compute Engine installs the diagnostic tool by default on public versions of Windows Server images later than
v20190714. Otherwise, if your Windows Server image version is earlier thanv20190714, or you are using a custom image, install the tool by using thegooget install google-compute-engine-diagnosticscommand. - If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Collecting diagnostic information from a VM
Run the diagnostic tool either directly from the VM, or remotely, by using theGoogle Cloud CLI. On Windows-based VMs, find the diagnostic tool in theC:\Program Files\Google\Compute Engine\diagnostics directory.
Permissions required for this task
To perform this task, you must have the followingpermissions:
roles/iam.serviceAccountTokenCreatoron the project
gcloud
Grant the
iam.serviceAccountTokenCreatorrole on the project:gcloud projects add-iam-policy-bindingPROJECT_ID \ --member user:EMAIL \ --role roles/iam.serviceAccountTokenCreator
Replace the following:
PROJECT_ID: the project IDEMAIL: the email address to grant theiam.serviceAccountTokenCreatorrole
Export the diagnostic information as an object to a Cloud Storagebucket.
gcloud compute diagnose export-logsVM_NAME \ [--collect-process-traces]
The optional
--collect-process-tracesflag specifieswhether the diagnostic tool collects a 10 minute trace of the runningsystem, which includes CPU, disk, file, and network activity. OnWindows-based VMs, this uses theWindows PerformanceRecorder.Replace the following:
VM_NAME: name of the VM to collect diagnosticinformation from
The log exporting process might take a few minutes to complete. View thestatus by using the
gcloud compute instances get-serial-port-outputcommand.Compute Engine formats the name of the bucket containing thediagnostic information as
diagnostic_logs_project_PROJECT_NUMBER.View or download the bucket by using thegcloud CLI, or, in theGoogle Cloud console, from theCloud Storage page:
What's next
Learn how tocapture screenshots from VMs.
Learn how toTroubleshoot Windowsinstances.
Learn how toTroubleshoot RDP.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.