0
0
GCPcloud~10 mins

Log Explorer and queries in GCP - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Log Explorer and queries
Start Log Explorer
Enter Query
Run Query
Logs Filtered
View Results
Refine Query or Export
This flow shows how you open Log Explorer, write a query, run it, see filtered logs, and then refine or export results.
Execution Sample
GCP
resource.type="gce_instance"
severity>=ERROR
jsonPayload.user="alice"
This query filters logs from Compute Engine instances with severity ERROR or higher and user named alice.
Process Table
StepActionQuery Part EvaluatedResulting FilterLogs Matched
1Start Log ExplorerN/ANo filterAll logs
2Enter query part 1resource.type="gce_instance"Only logs from GCE instancesSubset of all logs
3Add query part 2severity>=ERRORGCE logs with severity ERROR or higherSmaller subset
4Add query part 3jsonPayload.user="alice"GCE ERROR logs where user is aliceSmallest subset
5Run queryFull query combinedFinal filter appliedFiltered logs shown
6View resultsN/AN/ALogs matching all conditions displayed
7Refine or exportModify query or export logsUpdated filter or export actionLogs updated or exported
💡 Query executed and logs filtered based on all conditions.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
FilterNoneresource.type="gce_instance"resource.type="gce_instance" AND severity>=ERRORresource.type="gce_instance" AND severity>=ERROR AND jsonPayload.user="alice"Final combined filter
Key Moments - 2 Insights
Why do we combine multiple query parts with AND?
Because each query part narrows down logs further. Combining with AND means logs must meet all conditions, as shown in execution_table rows 2-4.
What happens if the query matches no logs?
The result will be empty logs in step 6. This means no logs meet all conditions, so you may need to adjust the query.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what filter is applied after step 3?
Aresource.type="gce_instance"
Bseverity>=ERROR
Cresource.type="gce_instance" AND severity>=ERROR
DjsonPayload.user="alice"
💡 Hint
Check the 'Resulting Filter' column in row for step 3.
At which step does the query include filtering by user 'alice'?
AStep 2
BStep 4
CStep 3
DStep 5
💡 Hint
Look for 'jsonPayload.user="alice"' in the 'Query Part Evaluated' column.
If you remove the severity filter, how would the logs matched change after step 3?
ALogs would be all GCE logs regardless of severity
BLogs would be only ERROR severity logs
CLogs would be only user alice logs
DLogs would be empty
💡 Hint
Refer to variable_tracker showing how filters combine to narrow logs.
Concept Snapshot
Log Explorer lets you write queries to filter logs.
Use conditions like resource.type, severity, and jsonPayload fields.
Combine conditions with AND to narrow results.
Run query to see matching logs.
Refine query to get precise logs or export results.
Full Transcript
Log Explorer is a tool to find specific logs in Google Cloud. You start by opening it, then write a query with conditions like resource type or severity. Each condition filters logs more. When you run the query, only logs matching all conditions show. You can then look at these logs, change the query to be more precise, or export the logs for analysis. This step-by-step process helps you find exactly the logs you need.