Viewing logs

The Cloud Code Log Viewer provides tools for searching and filtering logs.

Launching the Log Viewer

To launch the Log Viewer, open the Command Palette (press Ctrl/Cmd+Shift+P or click Manage icon Manage > Command Palette) and then type Cloud Code: View Logs.

Viewing logs for a specific resource

To view the logs for a specific resource, follow these steps:

  1. Open the Kubernetes Explorer or the Cloud Run Explorer by clicking Kubernetes Explorer icon Cloud Code - Kubernetes or Cloud Run explorer icon Cloud Code - Cloud Run.

  2. In the Kubernetes Explorer or the Cloud Run Explorer, right-click a resource and then and select View logs.

Viewing streaming logs

To have the Log Viewer display updated logs as the logs are generated, in the Log Viewer, turn the Streaming slider on.

Viewing Kubernetes logs using Cloud Logging

To display logs from GKE clusters with Cloud Logging enabled, follow these steps:

  1. To open the Log Viewer, open the Command Palette (press Ctrl/Cmd+Shift+P or click Manage icon Manage > Command Palette) and then type Cloud Code: View Logs.
  2. Select Kubernetes Application Logs from the Log Type list.
  3. To stream logs from multiple pods, turn on the Streaming slider and select all in the Pod list.
  4. Logs are displayed for the active cluster by default. To switch to a different cluster, select the cluster name from the Cluster list.

Log Viewer showing logs from a selected cluster

Viewing Kubernetes logs using kubectl

To display logs from a non-GKE cluster or a GKE cluster without Cloud Logging enabled, follow these steps:

  1. To open the Log Viewer, open the Command Palette (press Ctrl/Cmd+Shift+P or click Manage icon Manage > Command Palette) and then type Cloud Code: View Logs.
  2. Select Kubectl Logs from the Log Type list.
  3. In the Deployment or Pod list, select a deployment or pod to view logs from.

Viewing logs for a non-Cloud Logging cluster by setting the deployment
field within the Log Viewer search box to 'node-hello-world'

Viewing Cloud Run logs

To view logs from a Cloud Run service, follow these steps:

  1. To open the Log Viewer, open the Command Palette (press Ctrl/Cmd+Shift+P or click Manage icon Manage > Command Palette) and then type Cloud Code: View Logs.
  2. Select Cloud Run Logs from the Log Type list.
  3. Select a Cloud Run service from the Service list.
  4. To view the logs from a particular revision, select a revision using the Revision list.

Refining search results

You can refine your search results by clicking Search Logs and then typing search terms. This search includes the namespace, deployment, pod, container, and time. For clusters with Cloud Logging enabled, you can also filter by severity level.

Changing the display time

To change the display time to your preferred time zone, click More menu next to the Time column and then choose a time zone.