Reduce logging costs

After logging is enabled, you are responsible for setting up how you would like to route, store, and retain your logs. You may incur extra Google Cloud costs for log ingestion and retention if you exceed the usage and retention limits for no charge. See Google Cloud Observability pricing.

However, you can control logging costs by using any of the following approaches described in the following sections.

Reduce logging usage

You can limit the amount of log data that is ingested by excluding certain log entries. See Cloud Logging Exclusions and Excluding logs.

Export or route logs

You can route logs to other Google Cloud or external destinations to avoid the default ingestion and storage costs. Make sure you turn off log ingestion, as described in the next section, to avoid ingestion costs.

See Cloud Logging Exports and Exporting logs.

Turn off log ingestion

If you don't intend to use Fleet Engine logs, you can avoid potential Cloud Logging charges by turning off ingestion. By default, Fleet Engine logs are routed to the _Default log bucket.

The following command updates the _Default logging bucket to not ingest Fleet Engine logs.

    gcloud logging sinks update _Default \
    --log-filter='NOT LOG_ID("cloudaudit.googleapis.com/activity") \
    AND NOT LOG_ID("externalaudit.googleapis.com/activity") \
    AND NOT LOG_ID("cloudaudit.googleapis.com/system_event") \
    AND NOT LOG_ID("externalaudit.googleapis.com/system_event") \
    AND NOT LOG_ID("cloudaudit.googleapis.com/access_transparency") \
    AND NOT LOG_ID("externalaudit.googleapis.com/access_transparency") \
    AND NOT resource.type:"fleetengine.googleapis.com"''

See also Four steps to managing your Cloud Logging costs on a budget.