This page describes Cloud Workstations container output logs generated by
individual workstations.

## Overview

Standard container output logs and standard container error logs generated by
the workstation container are sent to
[Cloud Logging](https://docs.cloud.google.com/logging/docs/overview)
for monitoring and debugging.

To view container output logs for a particular workstation:

1. Ensure that your configuration specifies a service account that has the
   [Logs Writer](https://docs.cloud.google.com/logging/docs/access-control#logging.logWriter) role
   (`roles/logging.logWriter`) and [Monitoring Metric
   Writer](https://docs.cloud.google.com/monitoring/access-control#predefined_roles)
   (`roles/monitoring.metricWriter`) on your project.

   > [!CAUTION]
   > **Caution:** If you do not specify a service account on your configuration, the workstation uses a default service account. However, this default service account *cannot* be used for collecting container output logs.

   > [!NOTE]
   > **Note:** If you use a cross project service account, ensure the [Compute Engine default service account](https://docs.cloud.google.com/compute/docs/access/service-accounts#default_service_account) for the Workstation host project has `roles/iam.serviceAccountTokenCreator` on the service account.

2. Start a workstation.

3. To view container logs for this workstation, navigate to the
   Logs Explorer and update the query to the following:

       resource.type="gce_instance" labels.workstation_id=WORKSTATION_ID

   Replace <var translate="no">WORKSTATION_ID</var> with the name of the workstation
   that you want to look up.

   You can also filter by `labels.workstation_cluster_id` or
   `labels.workstation_config_id` as needed.

> [!NOTE]
> **Note:** Errors in the container output logs won't necessarily be logged at severity `ERROR`. Don't add a severity filter while looking for errors in the container output logs.

> [!NOTE]
> **Note:** If your workstation is failing to start during VM creation, there may be an issue with your VPC or project configuration, and container output logs may help identify this. However, in this case the VM won't be assigned to a workstation, so you will need to instead filter by cluster and config ID.

## What's next

- Learn more about the [Cloud Workstations logging API](https://docs.cloud.google.com/logging/docs/api/platform-logs#workstations)

- Understand and manage [Google Cloud platform logs](https://docs.cloud.google.com/logging/docs/api/platform-logs#managing-logs)

- Learn more about [Cloud Workstations audit logging](https://docs.cloud.google.com/workstations/docs/audit-logging)