Google Cloud Logging (Operations)
What you'll learn: How to collect logs from GKE, Cloud Run, and Compute Engine using Google Cloud Logging (formerly Stackdriver Logging).
What Is Google Cloud Logging?
Google Cloud Logging is GCP's fully-managed service for collecting, storing, and analyzing logs from your cloud resources. Think of it as a giant vacuum cleaner that automatically pulls logs from all your Google Cloud services into a centralized dashboard—no complex agent deployment needed for most services.
Logging from GKE, Cloud Run, and Compute Engine
Google Kubernetes Engine (GKE): GKE clusters automatically send container logs to Cloud Logging when you enable the logging agent. Stdout and stderr from your containers flow directly into Cloud Logging, tagged with metadata like pod name, namespace, and cluster. The gke-logging system collects these using a DaemonSet pattern behind the scenes.
Cloud Run: Fully serverless—logs from your containerized apps automatically appear in Cloud Logging with zero configuration. Every request, error, and custom log statement you write flows to the Logs Explorer without installing anything.
Compute Engine: VM instances require the Ops Agent (formerly Logging Agent) installed on the instance. Once installed, it ships system logs, application logs, and custom logs you configure. You can specify which log files to tail or collect structured logs from applications.
The Logs Explorer
All logs land in the Logs Explorer, where you can filter by resource type, severity, timestamp, or custom fields. The query language uses simple filters like resource.type="gke_container" or severity>=ERROR. Logs retain for 30 days by default, but you can export to Cloud Storage or BigQuery for long-term retention.
Key Takeaway: Google Cloud Logging provides automatic log collection for GKE and Cloud Run, while Compute Engine requires the Ops Agent—all logs funnel into the unified Logs Explorer for centralized observability.