Cloud Logging is GCP's unified log management service that automatically collects, searches, and analyzes logs from every GCP service. Powerful search via Logging Query Language (LQL), flexible routing through Log Router, and compliance support via Audit Logs are its core capabilities.
| Bucket | Retention | Use Case |
|---|---|---|
| _Default | 30 days (configurable, up to 10 years) | Default log destination |
| _Required | 400 days (fixed) | Admin Activity / System Event / Policy Denied |
| Custom | 1 day to 10 years | Long-term retention, Log Analytics |
# Errors from one service resource.type="cloud_run_revision" resource.labels.service_name="my-api" severity>=ERROR # A specific JSON field jsonPayload.user_id="user-123" jsonPayload.duration_ms>1000 # Time range timestamp>="2026-05-01T00:00:00Z" timestamp<="2026-05-31T23:59:59Z" # Negation with AND/OR severity=(ERROR OR CRITICAL) NOT textPayload:"health check" # A specific operation in the audit log protoPayload.methodName="storage.buckets.delete" protoPayload.authenticationInfo.principalEmail="[email protected]"
| Type | Description | Pricing |
|---|---|---|
| Admin Activity | Resource changes (always on, cannot be disabled) | Free |
| Data Access | Data reads / writes (must be enabled) | $0.50/GiB |
| System Event | System operations initiated by Google | Free |
| Policy Denied | IAM / VPC SC denials | Free |
# Counter: number of ERROR logs filter: 'resource.type="cloud_run_revision" severity>=ERROR' metric_kind: DELTA value_type: INT64 # Distribution: API response time filter: 'jsonPayload.event="api_request"' value_extractor: 'EXTRACT(jsonPayload.duration_ms)'
| Item | Price |
|---|---|
| Ingestion | $0.50/GiB |
| Storage (beyond 30 days) | $0.01/GiB/month |
| Free tier | 50 GiB of monthly ingestion |
| Log Router | Free (destination charges like BigQuery are separate) |
| Log Analytics | Free (Storage is billed separately) |
| Item | Cloud Logging | CloudWatch Logs | Azure Monitor Logs |
|---|---|---|---|
| Query language | LQL | CloudWatch Logs Insights | KQL |
| Retention | 30 days to 10 years | 1 day to indefinite | 4 days to 2 years (+ Archive) |
| Ingestion price | $0.50/GiB | $0.50/GiB | $2.30/GB |
| Long-term analytics | Log Analytics (BQ) | S3 export | Workspace |
What is the log retention period in Cloud Logging?
_Default Bucket = 30 days, _Required Bucket = 400 days (Audit Logs). Custom Buckets can retain logs for up to 10 years.
What is the log query language?
Logging Query Language (LQL). It uses a SQL-like syntax to filter by resource.type, severity, jsonPayload, and more.
What is a Log-based Metric?
Automatically generates Counter / Distribution metrics from logs. Example: convert ERROR log counts into a time-series metric and wire it up to alerts.
What can you do with Log Router (Sink)?
Routes logs to BigQuery / Cloud Storage / Pub/Sub / another Log Bucket. Essential for long-term analytics, SIEM integration, and cost optimization.
How many types of Audit Logs are there?
Admin Activity (always on), Data Access (must be enabled), System Event (always on), and Policy Denied (always on). Data Access generates by far the largest volume.
What is the pricing model?
Ingestion $0.50/GiB, storage $0.01/GiB/month (after 30 days). Includes 50 GiB of free monthly ingestion. Audit Admin Activity and System Event logs are free.
How does it compare to AWS CloudWatch Logs / Azure Monitor Logs?
GCP wins on LQL power; AWS uses CloudWatch Logs Insights; Azure uses KQL. GCP's strength is the combination of automatic GKE / Cloud Run collection plus LQL.
Can I send logs via OpenTelemetry?
Yes. Send logs to Cloud Logging via the OpenTelemetry Collector to avoid vendor lock-in on the application side.
Related Articles: Observability
Professional Cloud Developer (PCD): Complete Guide (2026)
Pass the PCD exam — Cloud Run, GKE, App Engine, Cloud SQL/Spanner. The developer-focused Professional cert.
Eventarc Guide: Event-Driven on GCP (2026)
Eventarc fundamentals — triggers, Cloud Audit Log sources, Cloud Run/Functions targets.
Professional Cloud Network Engineer (PCNE): Guide (2026)
Pass the PCNE exam — VPC, Cloud Interconnect, Cloud VPN, Cloud Load Balancing, hybrid networking.
Cloud Build Complete Guide: Triggers, Steps, Substitutions (2026)
Cloud Build — triggers, build steps, common CI patterns. The build engine of choice on GCP.
Note: Google Cloud is a trademark of Google LLC. For the latest information, see the official Cloud Logging documentation.
Practice with certification-focused question sets
Go to the GCP exam prep pageNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Google Cloud Certification Roadmap (2026)
Choose your GCP certification path — Foundational, Associate...
CDL Cloud Digital Leader: Complete Exam Guide (2026)
Pass the Cloud Digital Leader exam — cloud business value, G...
GAIL Generative AI Leader: Complete Exam Guide (2026)
Pass the Generative AI Leader exam — Gemini, Vertex AI, Work...
Vertex AI Fundamentals for GCP Certs (2026)
Vertex AI basics every cert candidate needs — Workbench, Pip...
Associate Cloud Engineer (ACE): Complete Guide (2026)
Pass the Associate Cloud Engineer exam — Console, gcloud, pr...