Course contentsShow
← Cloud and Infrastructure
Lesson 681 of 2,98912. Monitoring FoundationsFree lesson

Cloud Logging in GCP

Understanding Cloud Logging architecture, log sinks, log routers, and querying logs with Log Explorer.

Cloud Logging in GCP

What you'll learn: How Google Cloud Platform collects, routes, stores, and lets you query logs from all your cloud resources.

What Is Cloud Logging?

Cloud Logging is GCP's centralized logging service that automatically collects logs from all your Google Cloud resources, applications, and services. Think of it as a massive, organized filing cabinet where every action, error, and event across your entire cloud infrastructure gets recorded and indexed for easy retrieval.

Core Architecture Components

Log Router

The log router is the central hub that receives all logs. Every log entry that enters Cloud Logging passes through the router, which decides where each log should go based on rules you define.

Log Sinks

Log sinks are routing rules that tell the log router where to send logs. You can create sinks to export logs to:

  • Cloud Storage (long-term archival)
  • BigQuery (analysis and querying)
  • Pub/Sub (streaming to external systems)
  • Other GCP projects

Each sink has a filter that determines which logs match and should be routed.

Log Storage

By default, logs are stored in Cloud Logging's storage buckets with retention periods you can configure. Admin Activity logs are retained for 400 days; Data Access logs for 30 days by default.

Querying with Log Explorer

Log Explorer is the interactive interface for searching and analyzing your logs. You can filter by resource type, severity, time range, and use query language to find specific entries. It's like a powerful search engine built specifically for your infrastructure's story.

Unlike traditional grep-style searching, Log Explorer uses structured queries that understand log fields and metadata automatically.

Key Takeaway: Cloud Logging provides automated log collection with a router-and-sink architecture that lets you centralize, route, store, and query logs from all GCP resources through Log Explorer.