0
0
GCPcloud~30 mins

Log Explorer and queries in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Log Explorer and queries
📖 Scenario: You are a cloud administrator for a company using Google Cloud Platform (GCP). You want to learn how to use the Log Explorer tool to find specific logs from your cloud resources. This will help you quickly identify issues and monitor your applications.
🎯 Goal: Build a simple Log Explorer query step-by-step to filter logs from a specific GCP project and resource type, then refine the query to find error logs only.
📋 What You'll Learn
Create a basic log query filtering by project ID
Add a filter for a specific resource type
Refine the query to show only error severity logs
Complete the query with a time range filter
💡 Why This Matters
🌍 Real World
Cloud administrators use Log Explorer queries to monitor and troubleshoot cloud resources efficiently.
💼 Career
Knowing how to write and refine log queries is essential for roles like Cloud Engineer, Site Reliability Engineer, and DevOps Specialist.
Progress0 / 4 steps
1
Create a basic log query filtering by project ID
Write a Log Explorer query that filters logs from the project with ID my-sample-project. Use the exact syntax resource.project_id="my-sample-project".
GCP
Need a hint?

Start by specifying the project ID in your query using resource.project_id.

2
Add a filter for a specific resource type
Extend the query to filter logs from the resource type gce_instance. Add resource.type="gce_instance" to the existing query using AND.
GCP
Need a hint?

Use AND to combine filters for project ID and resource type.

3
Refine the query to show only error severity logs
Add a filter to show only logs with severity ERROR. Use severity="ERROR" combined with AND in your query.
GCP
Need a hint?

Filter logs by severity to focus on errors only.

4
Complete the query with a time range filter
Add a time range filter to show logs from the last 24 hours. Use timestamp >= "2023-01-01T00:00:00Z" format with AND. Replace the date with the exact ISO 8601 timestamp for 24 hours ago, for example timestamp >= "2023-01-01T00:00:00Z".
GCP
Need a hint?

Use the timestamp field to filter logs by time range in ISO 8601 format.