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.

Limitations

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

Before you begin

  • If you want to use the command-line examples in this guide:
    1. Install or update to the latest version of the gcloud command-line tool.
    2. Set a default region and zone.
  • If you want to use the API examples in this guide, set up API access.
  • 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.

Collecting diagnostic information from a VM

Run the diagnostic tool either directly from the VM, or remotely, by using the gcloud command-line tool. 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

gcloud

  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 \
      [--collect-process-traces]
    

    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 gsutil tool, or, in the Google Cloud Console, from the Cloud Storage page:

    Go to Storage

What's next