Troubleshoot Logs Explorer

This document explains common log viewing issues, and describes how to use the Google Cloud console to view and troubleshoot configuration mistakes or unexpected results.

Download of logs fails

You are using the Logs Explorer and click Download. The command starts but then fails to complete or reports an error.

To resolve this issue, reduce the time it takes for the command to execute by trying the following:

  • In the Download logs dialog, reduce the value of Maximum log entries.
  • Reduce the time period over which logs are queried.
  • In the query results toolbar, click Hide similar entries before you begin the download.
  • Modify your query to use indexed fields.

Can't find console logs for a VM instance

Logs written to the console of a Compute Engine instance might not be available in the Logs Explorer. To view these logs, do the following:

  1. In the navigation panel of the Google Cloud console, select Compute Engine, and then select VM instances:

    Go to VM instances

  2. Select the instance, and then select Serial port 1 (console) in the Logs section of the page.

You can configure your instances such that their serial port output is sent to Cloud Logging. For more information, see Enabling and disabling serial port output logging.

Get Google Cloud project or organization ID

To get a Google Cloud project or organization ID from anywhere in the Google Cloud console, expand the list of Google Cloud projects from the Google Cloud project and organization selector and find the Google Cloud project ID in the ID column.

Can't see log entries

If you don't see any log entries, check the following:

  • Is the correct Google Cloud project selected? If not, select the correct Google Cloud project from the Google Cloud project and organization selector.

  • Is your Google Cloud project using resources that generate logs and is there activity on those resources? Even if the Google Cloud project is new, it should have audit logs recording the fact that it was created. Verify you're using a resource that generates logs, by going to the "Mapping services to resource types" section in the Monitored resource list page.

  • Is the time range too narrow? Verify the time range in your query is correct.

  • View your current exclusion queries to ensure that the logs you're looking for aren't accidentally excluded.

  • Is the correct scope being used to view logs? For instructions on adjusting the scope of your search, see Refine scope.

My query is correct but I still don't see log entries

  • You can't see log entries that are older than the Logging retention period. See Log retention periods for the logs retention period in effect.

  • During periods of heavy load, there could be delays in sending logs to Logging or in receiving and displaying the logs.

  • The Logs Explorer doesn't show log entries that have timestamps in the future until the current time has "caught up" with them. This is an unusual situation, probably caused by a time skew in the application sending the logs.

  • The query scope was set too large and couldn't complete within a reasonable amount of time time. You might see this as "deadline expired before operation could complete". Try making your query more specific or reducing the time range.

Query returns an error

If you issue a query over a resource without specifying a bucket, then Cloud Logging uses the history of the sinks in the Google Cloud project to determine where entries might have been written for that resource. If Cloud Logging identifies more than 200 buckets where entries might have been written, then the query fails with the message Error: Invalid query.

To resolve this issue, refine the scope of your query to a subset of the storage. For more information, see Refine scope.

Query results time range doesn't match query

The logs data you see in the Query results and Log fields panes adjusts according to the time range captured by the histogram timeline. You adjust the histogram timeline using the histogram's time controls or the time-range selector. Adjusting these time controls doesn't alter the query expression in the Query pane.

If you have a query with a timestamp, the time-range selector is disabled, and the query uses the timestamp expression as its time-range restriction. If a query doesn't use a timestamp expression, then the query uses the time-range selector as its time-range restriction.