Associate Cloud Engineer ยท Logging and audit logs
How does the Log Router send logs elsewhere?
Sinks, inclusion and exclusion filters, destinations (BigQuery, Cloud Storage, Pub/Sub, log buckets), writer identity, aggregated sinks, exporting to on-premises via Pub/Sub.
Key points
- Through sinks: one inclusion filter, optional exclusion filters and a destination.
- Destinations: log bucket, BigQuery dataset, Cloud Storage bucket, Pub/Sub topic or another project.
- Writer identity (service account): needs write permission on the destination.
- Sinks only route new entries.
- Aggregated sinks at folder or organization level (--include-children) cover child projects.
- Pub/Sub: route to external or on-premises tools.
Source: https://docs.cloud.google.com/logging/docs/routing/overview
Practice questions
Which of these is NOT a supported destination for a log sink?
- A BigQuery dataset
- A Pub/Sub topic
- A Cloud SQL database
- A Cloud Storage bucket
Show answer
Answer: C. A Cloud SQL database
Sinks can write to log buckets, BigQuery, Cloud Storage and Pub/Sub. Cloud SQL is not a sink destination.
Which statements about log sinks are correct?
- A sink with an empty filter routes all log entries
- An entry matching an exclusion filter is not routed by that sink
- A new sink does not route entries written before it was created
- The _Required sink can be edited to add exclusion filters
- A new sink copies the last 30 days of logs to its destination
Show answer
Answer: A. A sink with an empty filter routes all log entries, B. An entry matching an exclusion filter is not routed by that sink, C. A new sink does not route entries written before it was created
A sink with no filter routes everything, exclusion filters remove entries that match them, and sinks never back-fill past entries. The _Required sink cannot be edited, and sinks do not export history.
True or false: creating a sink also exports the log entries that were already stored before the sink existed.
Show answer
Answer: False
False. Sinks cannot retroactively route entries; only entries written after the sink exists are sent.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
