Prepare and test your skills

Prepare and test your skills

Logs Explorer is the Google Cloud console interface for viewing and filtering log entries stored in Cloud Logging. Logs Explorer (opens in a new tab) lets you set a project, folder, or organization scope and then narrow results by resource type, log name, and query fields. Each log entry is a LogEntry with indexed fields such as resource.type and logName that the interface uses for filtering.
Opening Logs Explorer and setting scope defines which logs you are allowed to see. Go to the Logs Explorer page in the Google Cloud console by searching for Logs Explorer and selecting the result whose subheading is Logging. Then use the Project selector menu to select an existing Google Cloud project, folder, or organization. All later resource and log-name choices apply only inside that selected scope, so scope controls what exists to search.
Filtering by resource type and log name isolates entries from one kind of resource and one category of log. In the Query builder pane, select a value in Resource type for the Google Cloud resource whose logs you want to see, such as a Compute Engine (opens in a new tab) instance or Kubernetes cluster. Then select a value in Log name and click Run query to display only matching entries. This two-step narrowing is the fastest way to move from thousands of mixed logs to the events for one system.
The Query builder exposes common audit log types as log-name choices:
| Log name choice | Shows entries for |
|---|---|
| activity | Admin Activity audit logs, such as configuration changes |
| data_access | Data Access audit logs, such as reads of user data |
| system_event | System Event audit logs from Google Cloud systems |
| policy | Policy Denied audit logs where access was denied by policy |
Exam tip: If activity, data_access, system_event, or policy does not appear in the Log name menu, logs of that type are not currently available in the selected project, folder, or organization.
The query editor and Query builder work together to run basic filters and custom queries. The Query builder builds filters from Resource type and Log name selections without requiring syntax. The query editor runs Logging query language expressions directly when precise control is needed, and you select the time range before running the query.
A basic workflow for viewing audit logs in Logs Explorer follows an ordered sequence:
A top-to-bottom process flow with five numbered steps showing how scope, audit-log query, resource and log-name narrowing, and refinement lead to reviewable entries.
logName:"cloudaudit.googleapis.com" or protoPayload."@type"="type.googleapis.com/google.cloud.audit.AuditLog" in the query-editor field and click Run query.LogEntry fields in the Query Builder pane, such as resource.type or event fields, to isolate errors or critical events.This flow moves from broad scope to specific evidence because each step depends on the last. Scope controls what exists to search, resource type and log name control which stream is shown, and the added query fields control which entries remain for troubleshooting.
Examining log payloads and time-based correlations in Cloud Logging (opens in a new tab) means opening individual entries to read diagnostic details and then placing those entries in time order to explain system behavior. Logs Explorer (opens in a new tab) is the Google Cloud console tool where queries run, entries expand to full JSON, and results can be narrowed to a time window. Together, the payload shows what happened in one event, and the time view shows how events relate across resources.
A log entry payload is the full JSON record for a single logged event, including the message, metadata, and timestamp. Clicking a log entry in Logs Explorer reveals this complete view instead of just the one-line summary in the results table. The message itself can appear as textPayload for simple text, jsonPayload for structured application fields such as jsonPayload.message, or protoPayload for audit records that carry an AuditLog object. Because the timestamp, resource labels, and severity travel with the payload, each entry is self-describing and can be compared with entries from other services.
Diagnostic fields identify which resource produced the log, how serious it is, and what action or error it describes. Cloud Logging automatically collects several peer log types from clusters, apps, and Google Cloud services:
kubelet, containerd): logs from node services that manage Pod and container lifecycles, useful for container startups, Out of Memory (OOM) events, probe failures, volume mount errors, image pull errors, and NotReady nodes.stdout, stderr): standard output and error streams from containerized processes, useful for crashes, errors, and unexpected application behavior.Filtering in Logs Explorer targets diagnostic fields directly, so a query can isolate one Pod, namespace, severity, or message pattern:
| Filter | What it selects | Example |
|---|---|---|
resource.type | The type of Kubernetes resource | k8s_container, k8s_pod, k8s_node |
resource.labels.pod_name, resource.labels.namespace_name | The named Pod and namespace | Specific Pod in a specific namespace |
severity | The seriousness level | INFO, WARNING, ERROR, CRITICAL |
log_id | The log stream from the resource | stdout, stderr |
jsonPayload.message | Text inside the structured message | Regular expression search for an error string |
For example, a query that sets resource.type="k8s_container" plus a Pod name, namespace name, and severity=ERROR returns only error entries from that container. Opening a result then shows its timestamp, resource labels, severity, and full jsonPayload or protoPayload for diagnosis.
Time-based correlation is the practice of narrowing Logs Explorer to the window around a failure and reading entries in timestamp order to find cause and effect. The time-range control offers a preset range or a custom range, so analysis can start broad and then zoom to minutes before a Pod crash, node failure, or deletion. The histogram and results pane then show log volume over that window, which makes spikes, gaps, and repeating errors visible as patterns rather than isolated lines. Changing the range and re-running the query updates both the list and the distribution, so related warnings, errors, and audit actions can be lined up by time.
Viewing history this way follows an ordered workflow in Logs Explorer:
If no logs appear, switching to the advanced filter, clearing the filter box, and submitting an empty query shows all entries so the correct resource type can be identified from the payloads.
Exam tip: Expand the entry to read the timestamp plus jsonPayload or protoPayload for diagnosis, but change the time range to prove correlation across entries.
Correlation patterns link a symptom in one log type to its cause in another log type at nearly the same time. If a node reports NotReady, node logs from kubelet and containerd in the same window often reveal the underlying network problem or resource constraint. If a Pod failed to start, app logs from stdout and stderr show crashes first, while empty app logs point next to audit logs for scheduling events and to node logs for resource pressure or image pull errors. If a critical Deployment was deleted, Admin Activity audit logs identify which user or service account issued the delete API call, and the timestamp of that call anchors the search for related errors before and after.
The Logging Query Language (LQL) is the filter language used by Cloud Logging (opens in a new tab) to select specific log entries in the Logs Explorer query pane and in commands. A query is a line of field comparisons such as resource.type="cloudsql_database" that Cloud Logging matches against stored log entries. Basic interface controls pick a resource, log name, severity, and time range, while LQL adds precise control by combining those fields with boolean logic.
Field filters in LQL narrow results by naming the exact field and value to match in each log entry. Common fields include resource.type for the Google Cloud resource, resource.labels for the instance, service, or revision name, logName or LOG_ID() for the log stream, severity for the log level, and jsonPayload or protoPayload for structured data inside the entry. A query flows from the query pane to the log store, and only entries where all stated field conditions match are returned to the results table.
Three workload patterns show how the resource and label fields work together:
| Workload | resource.type filter | Additional label or log filter |
|---|---|---|
| Cloud SQL Database | resource.type="cloudsql_database" | Log name such as cloudsql.googleapis.com/postgres.log or cloudsql.googleapis.com/mysql.err |
| App Engine flexible environment | resource.type="gae_app" | resource.labels.module_id="default" |
| Cloud Run revision | resource.type="cloud_run_revision" | resource.labels.service_name="$SERVICE_NAME" and resource.labels.revision_name="$REVISION_NAME" |
Audit logs use the same idea with different fields, such as logName:"cloudaudit.googleapis.com" to return all audit logs or protoPayload."@type"="type.googleapis.com/google.cloud.audit.AuditLog" to match the audit payload type.
Field comparisons in LQL connect a field path to a value with a comparison operator. The operator = requires an exact match, such as jsonPayload.relevance = "ACTIVE" or resource.type="gae_app". The operator : matches log-name or text content, such as logName : projects/PROJECT_ID/logs/cloudaudit.googleapis.com or jsonPayload.impactedLocations : "us-central1". The operator != excludes a value, such as jsonPayload.relevance!=NOT_IMPACTED, so entries with that value are removed before results are shown. Special functions also filter by log identity, such as log_id("appengine.googleapis.com/cloud-sql-proxy") and LOG_ID(otlp-test-log), which return only entries from that named log.
Boolean operators in LQL combine two or more comparisons into one sophisticated search. The operator AND requires both sides to be true, so jsonPayload.impactedLocations : "us-central1" AND jsonPayload.impactedProducts : "Google Compute Engine" AND jsonPayload.state = "ACTIVE" returns only Service Health (opens in a new tab) entries that match location, product, and state at the same time. The operator OR accepts either side, so jsonPayload.relevance = ("IMPACTED" OR "RELATED") returns entries with either relevance value. Parentheses control grouping first, then AND and OR apply, which keeps multi-value checks together when they are combined with other filters.
Exam tip: Group OR values in parentheses when you combine them with AND, as in jsonPayload.relevance = ("IMPACTED" OR "RELATED"), so the OR is evaluated as one condition.
Running an LQL query in Logs Explorer applies the typed filter to the selected project, folder, or organization scope. The same filter string can be passed to the Google Cloud CLI with gcloud logging read, so console troubleshooting and command-line retrieval use identical logic.
resource.type="cloudsql_database" or logName:"cloudaudit.googleapis.com".gcloud logging read "resource.type=cloudsql_database" --project=PROJECT-ID --limit=10 --format=json to return matching entries as JSON.textPayload, jsonPayload, or protoPayload.= for exact match, : for log-name or text match, != to exclude a value, and AND, OR, and parentheses to combine conditions.gcloud logging read to return matching entries as JSON.Select the project, folder, or organization scope, then choose a Resource type and a Log name in the Query builder pane and click Run query to show only matching entries. Common audit log choices are activity for Admin Activity audit logs such as configuration changes, data_access for Data Access audit logs such as reads of user data, system_event for System Event audit logs from Google Cloud systems, and policy for Policy Denied audit logs where access was denied by policy. If one of those choices does not appear in the Log name menu, logs of that type are not currently available in the selected project, folder, or organization.
A log entry payload is the full JSON record for a single logged event, including the message, metadata, and timestamp, and it is viewed by clicking a log entry in Logs Explorer to reveal the complete view instead of the one-line summary in the results table. The message can appear as textPayload for simple text, jsonPayload for structured application fields such as jsonPayload.message, or protoPayload for audit records that carry an AuditLog object, and the timestamp, resource labels, and severity travel with the payload so each entry is self-describing.
In Logging Query Language (LQL), the = operator requires an exact match, the : operator matches log-name or text content, and the != operator excludes a value so entries with that value are removed before results are shown. The AND operator requires both sides to be true, the OR operator accepts either side, and parentheses control grouping first, so OR values should be grouped in parentheses when combined with AND. The same filter string runs in the Logs Explorer query editor for the selected project, folder, or organization scope and in gcloud logging read to return matching entries as JSON.
Your microservices application running in Google Cloud writes structured JSON logs to Cloud Logging. While troubleshooting an intermittent issue in the Logs Explorer, you find a failed request log entry that contains diagnostic details inside its jsonPayload, including a unique transaction identifier field named callId.
You want to write a query in the Logs Explorer to filter and correlate all log entries related to this specific transaction ID (d9577780-c608-4bff-9e12-4d9cdea6b298).
Which query filter should you use in the Logs Explorer?
Last updated