This document describes how to collect information about a virtual machine (VM) instance by using a diagnostic tool. Use the information that the tools collects to help with basic troubleshooting before contacting Cloud Customer Care.
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 a Cloud Storage bucket, which, by default, only you can access.
Before sharing the collected information with Customer Care, do the following:
Review the information for confidential or personally identifiable information (PII).
Delete or mask the information as necessary.
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 up authentication.
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:
gcloud initIf you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
-
Diagnostic information collected from the VM
This diagnostic tool collects information about the following:
Disks:
- Windows Management Instrumentation (WMI) object information about disks, partitions, and volumes
Events:
- Windows Events, including application events and system events
Networks:
Programs:
- WMI object information about processes, scheduled tasks, services, and Google Kubernetes Engine (GKE)
System:
- WMI object information about users, Remote Desktop Protocol (RDP) settings by using the rdp_status.ps1 script, and output from bcdedit, driverquery, msinfo32, pnputil, and systeminfo, and memory dump logs
For detailed information about how Compute Engine collects this information, see the public GitHub repository.
Limitations
- You can only collect diagnostic information from VMs created based on Windows Server.
Required roles
To get the permissions that
you need to run the diagnostic tool by using Google Cloud CLI,
ask your administrator to grant you the
Service Account Token Creator (roles/iam.serviceAccountTokenCreator) IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
To attach diagnostic information to a support case, you also need the Tech Support
Editor (roles/cloudsupport.techSupportEditor) role.
Collecting diagnostic information from a VM
Run the diagnostic tool either directly from the VM, or remotely, by using the Google Cloud CLI.
gcloud
If you haven't already, grant the
iam.serviceAccountTokenCreatorrole on the project to the user account or service account that will run thegcloud compute diagnose export-logscommand:gcloud projects add-iam-policy-binding PROJECT_ID \ --member user:EMAIL \ --role roles/iam.serviceAccountTokenCreatorReplace the following:
PROJECT_ID: the project IDEMAIL: the email address to grant theiam.serviceAccountTokenCreatorrole
Export the diagnostic information as an object to a Cloud Storage bucket using the
diagnose export-logscommand.gcloud compute diagnose export-logs VM_NAME \ [--collect-process-traces]
The optional
--collect-process-tracesflag specifies whether the diagnostic tool collects a 10 minute trace of the running system, which includes CPU, disk, file, and network activity. On Windows-based VMs, this uses the Windows Performance Recorder.Replace
VM_NAMEwith the name of the VM to collect diagnostic information from.The log exporting process might take a few minutes to complete. View the status by using the
gcloud compute instances get-serial-port-outputcommand.Compute Engine formats the name of the bucket containing the diagnostic information as
diagnostic_logs_project_PROJECT_NUMBER. View or download the bucket by using the gcloud CLI, or, in the Google Cloud console, from the Cloud Storage page:
Locally (Windows only)
To run the diagnostic tool from within a Windows VM, do the following:
Connect to the Windows VM.
Open a command prompt or PowerShell window with Administrator privileges.
Navigate to the directory containing the diagnostic tool:
cd "C:\Program Files\Google\Compute Engine\diagnostics"
Run the diagnostic tool:
.\diagnostics.exe
After the tool finishes running, it saves the collected diagnostic information to the compressed file
logs.zipin your current working directory.
Optional flags
-trace: captures additional tracing information. The tool captures a 10-minute trace of the system using the Windows Performance Recorder, which includes CPU, disk, file, and network activity.
Attach diagnostic information to a support case
If you have an open case with Cloud Customer Care, then you can attach diagnostic information directly to the case when you collect it. This option saves you from downloading the archive from Cloud Storage and attaching it to the case yourself.
The diagnostic information is attached to the case without a review step. If you need to review the information or remove confidential or personally identifiable information (PII) before you share it, then don't use this option. Instead, collect the information as described in Collecting diagnostic information from a VM, review the archive in Cloud Storage, and then attach it to the case.
Before you attach diagnostic information to a support case, make sure that:
- Your organization has a Customer Care plan that lets you create technical support cases (Standard, Enhanced, or Premium Support).
- You have the Tech Support Editor (
roles/cloudsupport.techSupportEditor) role. If the case belongs to an organization, then you need the role on the organization. - The Cloud Support API is enabled in the project.
- The case is open.
To attach diagnostic information to a support case, do the following:
Make sure that you have installed the alpha commands component:
gcloud components install alpha
Run the
gcloud alpha compute diagnose export-logscommand with the--support-caseflag:gcloud alpha compute diagnose export-logs INSTANCE_NAME \ --zone=ZONE \ --support-case=CASE_NUMBERReplace the following:
- INSTANCE_NAME: the name of the Windows Server compute instance.
- ZONE: the zone of the instance.
- CASE_NUMBER: the number of an open support case.
The command checks that the case exists and that you can add attachments to it before it starts collecting. It then waits for the instance to finish collecting diagnostic information, which might take a few minutes, and uploads the archive to the case. The archive also stays in the Cloud Storage bucket, the same as when you omit the
--support-caseflag.
What's next
Learn how to capture screenshots from VMs.
Learn how to Troubleshoot Windows instances.
Learn how to Troubleshoot RDP.