Viewing logs

This page describes how to launch the Log Viewer and view and filter logs from your application.

Launching the Log Viewer

Cloud Code comes with a Log Viewer to help you monitor your application.

To launch the Log Viewer, type Cloud Code: View Logs using the Command Palette (accessible with Ctrl/Cmd+Shift+P or through the 'Manage' menu marked with a gear icon Manage icon).

Tip: Depending on the type of your application, you can also quickly access logs by finding your resource within either the Kubernetes Explorer or the Cloud Run Explorer, right-clicking it, and selecting View logs to display your specified logs in the Log Viewer.

Viewing logs from clusters

Kubernetes logs

Using Cloud Logging

If you have clusters with Cloud Logging enabled, you can find all the Kubernetes logs from these clusters by opening the Log Viewer and selecting Kubernetes Application Logs from the Log Type dropdown.

Additionally, if you're using Google Kubernetes Engine clusters, you can stream logs from multiple pods by turning on the streaming slider and setting all from the Pod dropdown.

To switch to a different cluster, you can select the cluster name from the Cluster dropdown.

Log Viewer showing logs from a selected cluster

Using kubectl

If you want to view Kubernetes logs from your current active cluster using kubectl, select Kubectl Logs from the dropdown. You'll need to select a deployment or pod to view logs from, using the deployment or pod dropdowns.

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

Cloud Run logs

If you want to view logs from a Cloud Run Service, select Cloud Run Logs from the Log Type dropdown. You'll need to select a Cloud Run Service from the Service dropdown to view the logs from. You can also filter results by revision using the Revision dropdown.

Viewing logs for a Cloud Run service

Refining search results

You can perform basic text filtering on the results displayed within the Log Viewer by using the search box at the top of the page. This includes filtering by namespace, deployment, pod, container, and time. Additionally, for clusters with Cloud Logging, you can also filter by severity level.

Tip: You can change the display time to your preferred time zone by selecting the three-dotted menu icon next to the 'Time' column and choosing a time zone.

Refining log viewer results by setting time to 'Local time' using the three dotted menu near the time label as well as setting the deployment field within the search box to a guestbook deployment

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.