Collecting diagnostic information

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

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 Google Support, do the following:

  1. Review the information for confidential or personally identifiable information (PII).

  2. Delete or mask the information as necessary.

Diagnostic information collected from the VM

This diagnostic tool collects information about the following:

For detailed information about how Compute Engine collects this information, see the public repository.


  • You can only collect diagnostic information from VMs created based on Windows Server.

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 than v20190714, or you are using a custom image, install the tool by using the googet install google-compute-engine-diagnostics command.
  • If you haven't already, set up authentication. Authentication is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine as follows.

    Select the tab for how you plan to use the samples on this page:


    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.


    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.


    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, then initialize it by running the following command:

      gcloud init

    For more information, see Authenticate 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 the Google Cloud CLI. On Windows-based VMs, find the diagnostic tool in the C:\Program Files\Google\Compute Engine\diagnostics directory.

Permissions required for this task

To perform this task, you must have the following permissions:

  • roles/iam.serviceAccountTokenCreator on the project


  1. Grant the iam.serviceAccountTokenCreator role on the project:

    gcloud projects add-iam-policy-binding PROJECT_ID \
        --member user:EMAIL \
        --role roles/iam.serviceAccountTokenCreator

    Replace the following:

    • PROJECT_ID: the project ID
    • EMAIL: the email address to grant the iam.serviceAccountTokenCreator role
  2. Export the diagnostic information as an object to a Cloud Storage bucket.

    gcloud compute diagnose export-logs VM_NAME \

    The optional --collect-process-traces flag 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 the following:

    • VM_NAME: name of the VM to collect diagnostic information from
  3. The log exporting process might take a few minutes to complete. View the status by using the gcloud compute instances get-serial-port-output command.

  4. 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:

    Go to Storage

What's next