This document provides information on how to use the Cloud Logging Logs Viewer to review logs.
Before you begin
Configure your application to use the Cloud Logging API.
Sign in your account to access Google Cloud resources.
- Select Tools -> Google Cloud Tools -> Manage Accounts... to select your account.
Accessing Logs Explorer
To access Cloud Logging Logs Explorer, select Tools -> Google Cloud Tools -> Show Stackdriver Logs Explorer.
The Google Stackdriver Logging tab opens.
Or, you can open the Logs Explorer for a specific project from Google Cloud Explorer by selecting Tools -> Google Cloud Tools -> Google Cloud Explorer. Right click the project and select Browse Stackdriver Logs.
Getting around the interface
The Logs Explorer interface has the following major components:
A search bar to filter log entries by label or text search.
Drop down menus to filter the list by resources, logs, and severity levels.
Jump to time drop down menu to view a specific date and time in the logs.
A Refresh button to retrieve the latest logs in descending order.
Auto load log stream controls whether or not to display new log entries as they arrive.
Clicking Play starts the stream of the latest logs. The stream will stop if you scroll the logs display.
Clicking Pause stops the logs stream.
The table of log summaries that you can click to view the full details for individual log entries.
An Expand all down arrow at the top right corner of the log entries panel to show the details of all log entries. This action may take some time if the panel has a lot of log entries.
If available, a source link to locate the source code that generates the log entry.
Navigating to source code
Logs Explorer allows you to navigate to the source code that generates a log entry. To enable this feature, you should build your project from a local git repository, and you must add source location information to log entries.
Adding source location to your log
Configure your application to provide source code location information in the logs:
Write location information for the log entries using the following sample from GitHub.
Deploy a
source_context.json
file at the root of the application.If you publish the solution via Cloud Tools for Visual Studio, the extension automatically generates and deploys the file.
After you complete these steps, the log entries contain a sourceLocation field with File and Line information. The optional Function line can contain the assembly name, version, or function name.
Clicking the source link navigates to the source code if the source file is accessible.
Viewing the logs
In the Logs Explorer interface, you can filter the log entries or search for specific logs to display.
Filtering the logs
You can filter the log entries to see only those logs you are interested in.
In the resource type and instance drop-down menu, you can select all instances of a particular resource type you wish to see, or view a specific instance. For a list of resource types, see the Monitored Resources and Services.
In the log type drop-down menu, select the named logs you want to view or select All logs. The menu only shows the logs that the selected resource generates.
In the log severity drop-down menu, select the severity level you want to view. Selecting All log levels includes log entries that do not have a severity level.
In the Jump to time drop-down menu, select a date and time. Choose if you want to see logs before or after the selected timestamp.
You can also click To Advanced Filter to access the advanced filter bar where you can filter the log entries through queries. Click the Advanced filter help link for more information.
Searching the logs
In the search bar, search for keywords that appear in the log entries.
Showing similar logs
You can click the value of an individual field in the expanded log entry view and then either show or hide all log entries with the same value.
When you show similar log entries, the advanced filter bar displays, where you can edit the filter and click Submit Filters. Click the Advanced filter help link for more information.