Centralize log data

Cloud Logging supports write- and read-time aggregation of log entries. Configure log sinks to route entries to a centralized log bucket (write-time), and configure log scopes to query logs across projects (read-time).

Log storage and views

When you create a project, folder, or organization, Cloud Logging automatically creates two log buckets, _Required and _Default. If default resource settings for Cloud Logging are configured, then the system sets the location and encryption key based on those settings. Otherwise, the system selects a location and uses a Google-owned and Google-managed encryption key. After a log bucket exists, you can't change its location or encryption model.

By default, the _Required and _Default log sinks route log entries to the log buckets of the same names. You can modify the _Default log sink.

Every log bucket has a system-created log view, _AllLogs, which includes every log entry. The _Default log bucket has a second log view, _Default; this view excludes Data Access audit logs.

Cloud Logging lets you create custom log buckets and log views and change which log entries are stored and how they are routed.

Configure write-time aggregation using log sinks

To centralize log storage across multiple Google Cloud projects, we recommend these steps:

  1. Select a dedicated project to store your log data.

  2. Route log entries to that dedicated project.

  3. In the dedicated project, store operational logs in the _Default log bucket. If you centralize required logs, store them in a custom log bucket whose name includes Audit, regardless of capitalization. Required logs are audit logs that are always collected and stored.

For information about other routing options, see Route to a project versus a log bucket and Custom versus _Default log buckets.

Select a project that is dedicated to storing your log data

Choose a dedicated Google Cloud project whose lifecycle you manage. Don't store centralized telemetry in a Google-managed project, such as a google-mpf-* or google-mpo-* management project. Google Cloud deletes those projects—along with your log buckets and configuration—when you disable the capability or delete its capability configuration:

  • Standard project (recommended): A standard project is a project that you create. You manage its lifecycle. Use a standard project when you don't govern the boundary with a self-managed management project.
  • Self-managed management project (recommended): A self-managed management project is a project that you create and then convert to a management project by creating a capability configuration that designates it. For cross-project boundaries, the capability configuration attaches one or more boundaries. You manage its lifecycle. Use this option when you govern the boundary with a self-managed management project.
  • Google-managed project (not recommended): Google Cloud creates this project automatically when you enable application management on a folder, or when you create a capability configuration without specifying a standard project. The project ID follows the pattern google-mpf-* or google-mpo-*. Google Cloud deletes the project if you disable the capability or delete the capability configuration.

    Don't use a Google-managed project to centralize your log data. Instead, create a standard Google Cloud project anywhere in your organization to store your centralized logs. If you plan to convert that project into a self-managed management project, create it directly under the parent folder or organization of your capability configuration.

Route log entries to the dedicated project

How you route log entries from source resources to your dedicated project depends on your resource hierarchy:

  • Centralize logs for a folder: Create a folder-level aggregated sink with the dedicated project as its destination and configure these settings:

    • Leave the inclusion filter empty to match all log entries.
    • Route log entries from child resources.
    • Enable sink interception so child sinks, except for the _Required sinks in originating resources, don't also route matching entries.
    • If the dedicated project resides in the folder, then add an exclusion filter for that project so the aggregated sink doesn't route the dedicated project's own logs back to itself.

    You can also create organization-level aggregated sinks; see Aggregated sinks overview.

  • Centralize logs for specific or tag-bounded projects: Update the _Default log sink in each source project to route log entries to the dedicated project. This update routes only non-required logs because the _Default sink excludes required logs by default. To centralize required logs as well, either remove exclusions from the _Default log sink or create a custom log sink whose inclusion filter matches the _Required log sink's inclusion filter.

Configure sinks for your centralization use case

In your dedicated project, store operational logs in _Default and, if you centralize required logs, route them to a custom bucket such as CentralizedAudit:

  • Operational logs (_Default): Store operational logs in the _Default log bucket rather than creating a custom log bucket, because services that build dashboards or compute performance metrics expect operational log data in _Default. No sink changes are needed; the pre-configured _Default sink matches all non-required log entries and routes them to _Default.

    If you want to use SQL to analyze the stored log data, then upgrade the _Default log bucket to use Observability Analytics.

  • Required logs (CentralizedAudit): Because the built-in _Required sink only matches entries that originate in the dedicated project, create a custom sink and a custom log bucket to store incoming required logs forwarded from source projects. Don't store centralized required logs in the _Default log bucket.

    1. Create a custom log bucket, CentralizedAudit, upgrade it to use Observability Analytics, and configure its retention period.

    2. Create a custom log sink, routeAudit, targeting the CentralizedAudit bucket, and set its inclusion filter to match the _Required sink's filter.

    3. Add an exclusion filter for the dedicated project so its own required logs aren't stored in both _Required and CentralizedAudit. Omit this exclusion only if you want CentralizedAudit to retain required logs for all projects in one log bucket.

Configure read-time aggregation using log scopes

To configure read-time aggregation:

  1. Identify the project where you want to view your log data. This project might be different from the project where you store your centralized log data.

    If you use a management project, then use it to view your log, metric, and trace data.

  2. In your viewing project, create a custom log scope, add the relevant log views, and set it as the default log scope.

    When you open Logs Explorer, the page queries the listed views and displays data you have permission to see.

A log scope can list at most 100 log views, though you can create multiple log scopes and switch between them from the Logs Explorer toolbar.

For more information, see Configure observability scopes for multi-project queries.

Roles required to view log data

Principals who view centralized logs need permissions on both the log views in your storage project and the log scopes in your viewing project:

  • Access log entries in views: Grant Logs View Accessor (roles/logging.viewAccessor) to let principals query custom views and views on custom log buckets. To restrict access to specific log entries, grant this role on custom views, on the system-created _AllLogs and _Default views, or on the storage project with an IAM condition. For more information, see Grant access to a log view.
  • Select and query log scopes: Grant Logs Viewer (roles/logging.viewer) on the viewing project so principals can select log scopes in Logs Explorer. This grant applies only to the viewing project and doesn't grant access to logs stored in a separate storage project.

Architectural choices for write-time aggregation

The following sections provide detailed comparisons of the routing and storage options available during write-time aggregation.

Route to a project versus a log bucket

The destination of an intercepting aggregated sink must be a project. Non-intercepting aggregated sinks and project-level sinks can route log entries to a project or to a log bucket in any project.

Routing option Advantages Disadvantages
Route to another standard project or to a self-managed management project (recommended)

Best when: you centralize log data across a folder or organization, need central alerts or metrics, or want to eliminate duplicate child storage.

  • Central log-based alerting: Destination alerting policies can scan incoming project-originated logs in real time when those logs are routed to a log bucket in the destination project.
  • Central log-based metrics: Supports project- and bucket-scoped user-defined metrics and increments system-defined metrics.
  • Loose coupling: Source sinks specify only the project ID; destination administrators configure buckets, retention, CMEK, and views independently.
  • Required for intercepting sinks: Enables folder- or organization-level intercepting aggregated sinks.
  • One-hop limit: Destination sinks can't forward to another project—only to non-project destinations such as buckets, BigQuery, or Pub/Sub.
  • Multi-stage management: Requires maintaining source or aggregated sinks and destination sinks.
  • Exclusion filters required: Destination sinks process all incoming logs (and _Default excludes required logs), so explicit filters are needed to avoid unintended storage.
Route directly to a log bucket in another project

Best when: individual projects export directly to central storage without central alerting or project-scoped metrics.

  • Single-hop pipeline: Logs are routed directly from source projects to the destination bucket.
  • Router isolation and no duplicates: Incoming logs bypass the destination project's Log Router, avoiding unintended impacts on its sinks, metrics, or local storage.
  • Tight coupling: Source sinks specify the full bucket path (project ID, location, and bucket name) and must be updated if bucket details change.
  • No central log-based alerts: Alerting policies created in the project that stores the log bucket can't scan incoming logs because the logs bypass the project's Log Router.
  • No central project-scoped metrics: Only bucket-scoped metrics are supported in the destination project.
  • IAM overhead: Each source sink's service account needs bucket permissions (such as roles/logging.bucketWriter).

Custom versus _Default log buckets

Store operational logs in the destination project's _Default bucket so services that build dashboards or compute performance metrics can find the log data. If you need to control the location or CMEK for this bucket, configure default resource settings for Cloud Logging before you create the destination project.

If you centralize required logs, create a custom log bucket whose name includes Audit, regardless of capitalization, rather than using _Default. Unlike _Default, custom buckets let you choose any supported storage region and CMEK at creation time and can be deleted later.

What's next

For more information, see the following documents: