Cloud Logging Study Notes
Cloud Logging is the centralized, fully managed log management service that collects logs from Google Cloud resources, applications, and custom sources in near real time. You search logs in Logs Explorer, route them with sinks, and retain them in log buckets. The ACE exam tests sinks, retention, and choosing the right destination for analysis or compliance.
Key facts
- Every log is a timestamped log entry with severity, resource information, and a payload that can be plain text or structured JSON, and structured logs are far easier to filter and parse.
- Google Cloud services write many logs automatically, while application logs are collected by the Ops Agent on virtual machines, by Fluent Bit sidecars, or by client libraries and API calls.
- Log buckets are the storage containers for logs in a project, with a required _Default bucket and a required _Required bucket for audit and system logs that have special handling.
- By default at the time of writing, most logs in the _Default bucket are retained for 30 days, while retention is configurable on custom buckets up to a maximum that suits compliance needs.
- Log sinks use a filter and a destination to route matching entries to another project bucket, BigQuery, Cloud Storage, Pub/Sub, or supported external destinations for long-term use.
- Logs Explorer is the console query interface for searching, filtering by resource, severity, and time, creating log-based metrics, and saving queries for operational investigations.
- Log-based metrics count matching entries over time and can feed Cloud Monitoring charts and alerting policies, for example alerting when error log volume spikes unexpectedly.
- Exclusion filters and sink filters let you reduce volume and cost by dropping noisy debug entries, but excluded audit-related logs in the _Required bucket cannot be treated the same way.
What the exam expects you to know
- The exam tests creating a sink to export logs to BigQuery for analysis, to Cloud Storage for archival, or to Pub/Sub for streaming processing, based on the scenario goal.
- Expect questions on extending retention beyond the default period, where the solution is a custom log bucket with longer retention or an export sink to cheaper archival storage.
- You should know Logs Explorer is the place to search and troubleshoot with filters, and that writing a correct inclusion filter is central to sink configuration questions.
- Scenarios often require centralizing logs from many projects, solved by an organization or folder-level aggregated sink that routes to a central project destination.
- The exam checks log-based metrics and alerts: counting errors in logs and alerting in Monitoring is a standard pattern distinguishing logging from plain storage.
- Questions may ask how VM application logs reach Cloud Logging, expecting the Ops Agent installed on Compute Engine instances rather than assuming automatic collection.
Cloud Logging vs Cloud Logging vs Cloud Monitoring: when to use which
Use Cloud Logging when your data is discrete events and text: application errors, request logs, audit events, and debug messages you need to search, filter, and route. Use Cloud Monitoring when your data is numeric time series: CPU, latency, request counts, and SLO indicators you need to chart, alert on, and dashboard. They integrate through log-based metrics, which turn log patterns into numbers Monitoring can alert on. For the exam, if the scenario says read the error message, choose Logging; if it says graph the metric and page on a threshold, choose Monitoring. See also the Cloud Logging vs Cloud Monitoring notes.
Useful gcloud commands
gcloud logging read "resource.type=gce_instance" --limit=20
gcloud logging sinks list
gcloud logging sinks create SINK_NAME bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID --log-filter="severity>=ERROR"
gcloud logging buckets list --location=globalCommon exam traps
- Trap: Assuming a sink copies historical logs from before it was created. Sinks route new matching entries going forward; they are not a retroactive export of old bucket contents.
- Trap: Trying to delete or shorten the _Required bucket like a normal bucket. Audit and system logs there have protected retention and handling because of compliance requirements.
- Trap: Exporting everything without a filter to control cost. High-volume debug logs exported to BigQuery can be expensive; the exam rewards filtering to the severities and resources needed.
- Trap: Forgetting the sink writer identity needs permission on the destination. A sink to another project, BigQuery, or Storage fails until its service account is granted write access there.
Frequently asked questions
How do you keep logs for a year for compliance?
Create a custom log bucket with retention set to your required period, or create a sink exporting matching logs to Cloud Storage or BigQuery with lifecycle and retention set for long-term keeping. The default bucket retention is too short for most compliance needs. The exam expects you to choose one of these deliberate options rather than hoping default logs remain available.
What is an aggregated sink?
An aggregated sink is created at the organization or folder level and can include logs from all child projects, routing them to a central destination. It solves multi-project centralization without creating a sink in every project. You must enable interception of child logs correctly, and the destination still needs permissions for the sink writer identity.
How do custom application logs get into Cloud Logging?
Install the Google Cloud Ops Agent on Compute Engine VMs, use a logging client library or API from the application, or run a collector such as Fluent Bit in container environments. Simply writing to a local file on a VM does not automatically send it to Cloud Logging. Exam VM scenarios almost always require naming the Ops Agent explicitly.
Study aid disclaimer: Cloud Cert Notes is an independent educational study aid. It is not affiliated with, endorsed by, or sponsored by Google, Microsoft, Amazon, Oracle, or Alibaba. Google Cloud, Associate Cloud Engineer, and Cloud Digital Leader are trademarks of Google LLC; all other certification names and product names are trademarks of their respective owners. Always confirm service details against the official provider documentation before sitting an exam.