What is the purpose of Log Explorer in Google Cloud?
Log Explorer helps you find, view, and analyze logs from your Google Cloud resources in one place.
Click to reveal answer
beginner
What is a basic component of a Log Explorer query?
A basic query includes a filter that selects logs by resource type, severity, or text content.
Click to reveal answer
intermediate
How do you filter logs by severity in Log Explorer?
Use the filter expression like: severity>=ERROR to see logs with error or higher severity.
Click to reveal answer
beginner
What does the 'resource.type' field represent in a Log Explorer query?
It identifies the Google Cloud resource that produced the log, like 'gce_instance' for a VM.
Click to reveal answer
beginner
How can you use Log Explorer to find logs containing a specific text?
Include the text in quotes in the query, for example: "error connecting to database".
Click to reveal answer
Which field would you use to filter logs by the Google Cloud resource type?
AlogName
Bresource.type
Cseverity
Dtimestamp
✗ Incorrect
The 'resource.type' field specifies the type of Google Cloud resource that generated the log.
What does the filter expression 'severity>=WARNING' do in Log Explorer?
AShows logs with severity exactly WARNING
BShows logs with severity lower than WARNING
CShows only WARNING logs
DShows logs with severity WARNING or higher
✗ Incorrect
The '>=' operator means logs with WARNING, ERROR, or CRITICAL severity will be shown.
How do you search for logs containing the phrase 'timeout error'?
Atimeout error
Btimeout OR error
C"timeout error"
Dtimeout AND error
✗ Incorrect
Using quotes searches for the exact phrase 'timeout error' in the logs.
Which of these is NOT a valid Log Explorer query filter?
Atimestamp = "yesterday"
Bresource.type = "gce_instance"
Cseverity >= ERROR
DtextPayload : "failed"
✗ Incorrect
You cannot filter timestamp by a string like 'yesterday'; timestamps require specific date/time formats.
What does the 'logName' field represent in a log entry?
AThe name of the log stream or log file
BThe severity level of the log
CThe resource type that generated the log
DThe timestamp of the log entry
✗ Incorrect
'logName' identifies the specific log stream or log file within Google Cloud Logging.
Explain how to build a basic query in Log Explorer to find error logs from Compute Engine instances.
Think about filtering by resource type and severity level.
You got /4 concepts.
Describe how you would search for logs containing a specific phrase and filter by time range in Log Explorer.
Combine text search with timestamp filters.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the Log Explorer in Google Cloud Platform?
easy
A. To manage user permissions
B. To create virtual machines
C. To search and filter logs generated by cloud resources
D. To deploy applications automatically
Solution
Step 1: Understand Log Explorer's role
Log Explorer is designed to help users find specific log entries by searching and filtering logs.
Step 2: Compare with other options
Creating VMs, managing permissions, and deploying apps are done by other GCP services, not Log Explorer.
Final Answer:
To search and filter logs generated by cloud resources -> Option C
Quick Check:
Log Explorer = Search and filter logs [OK]
Hint: Log Explorer is for logs, not for VMs or permissions [OK]
Common Mistakes:
Confusing Log Explorer with Compute Engine
Thinking it manages user roles
Assuming it deploys apps automatically
2. Which of the following is the correct syntax to filter logs for entries where the severity is ERROR in Log Explorer?
easy
A. severity = "ERROR"
B. severity == "ERROR"
C. severity="ERROR"
D. severity = ERROR
Solution
Step 1: Recall Log Explorer filter syntax
Log Explorer uses single equals (=) with quotes around string values.
Step 2: Check each option
severity = "ERROR" uses correct syntax: single equals (=) with quotes around string values. Omitting quotes, using double equals, or missing spaces around the operator are incorrect.
Final Answer:
severity = "ERROR" -> Option A
Quick Check:
Use = and quotes for strings [OK]
Hint: Use = and quotes for string filters in Log Explorer [OK]
Common Mistakes:
Using == instead of =
Omitting quotes around string values
Missing spaces around =
3. Given the query resource.type = "gce_instance" AND severity = "WARNING", what kind of log entries will this return?
medium
A. All logs from any resource with severity WARNING
B. Logs from Google Compute Engine instances with any severity
C. Logs from any resource with severity ERROR or WARNING
D. Logs from Google Compute Engine instances with severity WARNING
Solution
Step 1: Analyze the query conditions
The query filters logs where resource.type equals "gce_instance" AND severity equals "WARNING".
Step 2: Understand the AND operator effect
Both conditions must be true, so logs must be from GCE instances and have WARNING severity.
Final Answer:
Logs from Google Compute Engine instances with severity WARNING -> Option D
Quick Check:
AND means both conditions true [OK]
Hint: AND means both filters must match logs [OK]
Common Mistakes:
Thinking OR is used instead of AND
Ignoring resource.type filter
Assuming severity includes ERROR
4. You wrote this query in Log Explorer: resource.type = "gce_instance" OR severity = "ERROR" AND timestamp > "2024-01-01T00:00:00Z". Why might this not return expected results?
medium
A. Because AND has higher precedence than OR, so the query groups incorrectly
B. Because timestamp filter syntax is invalid
C. Because severity cannot be combined with resource.type
D. Because OR operator is not supported in Log Explorer
Solution
Step 1: Understand operator precedence in Log Explorer
AND has higher precedence than OR, so the query is read as resource.type = "gce_instance" OR (severity = "ERROR" AND timestamp > ...).
Step 2: Identify grouping issue
This means logs with resource.type "gce_instance" are included regardless of timestamp or severity, which may not be intended.
Final Answer:
Because AND has higher precedence than OR, so the query groups incorrectly -> Option A
Quick Check:
AND binds tighter than OR [OK]
Hint: Use parentheses to group AND/OR conditions correctly [OK]
Common Mistakes:
Ignoring operator precedence
Assuming OR has higher precedence
Thinking OR is unsupported
5. You want to find logs from Compute Engine instances that either have severity ERROR or occurred after March 1, 2024. Which query correctly expresses this in Log Explorer?
hard
A. (resource.type = "gce_instance" AND severity = "ERROR") OR timestamp > "2024-03-01T00:00:00Z"
B. resource.type = "gce_instance" AND (severity = "ERROR" OR timestamp > "2024-03-01T00:00:00Z")
C. resource.type = "gce_instance" OR severity = "ERROR" AND timestamp > "2024-03-01T00:00:00Z"
D. resource.type = "gce_instance" AND severity = "ERROR" OR timestamp > "2024-03-01T00:00:00Z"
Solution
Step 1: Understand the requirement
We want logs from GCE instances where severity is ERROR or logs from GCE instances after March 1, 2024.
Step 2: Analyze each option's logic
resource.type = "gce_instance" AND (severity = "ERROR" OR timestamp > "2024-03-01T00:00:00Z") groups severity and timestamp with OR inside parentheses combined with resource.type using AND, matching the requirement.
Step 3: Check other options
(resource.type = "gce_instance" AND severity = "ERROR") OR timestamp > "2024-03-01T00:00:00Z" includes logs after March 1 from any resource, not just GCE instances. The remaining options lack parentheses, causing wrong precedence.
Final Answer:
resource.type = "gce_instance" AND (severity = "ERROR" OR timestamp > "2024-03-01T00:00:00Z") -> Option B
Quick Check:
Use parentheses to combine OR inside AND [OK]
Hint: Use parentheses to group OR inside AND correctly [OK]
Common Mistakes:
Missing parentheses causing wrong logic
Including timestamp filter outside resource.type scope
Assuming OR has same precedence as AND
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.