Other Articles

General – Configure Log Bucket Retention

Secure Configuration Checks > GCP

This check ensures that every Cloud Logging bucket retains logs for at least 90 days. This gives you enough history for security investigations and audits.

Check Details

  • Resource: Cloud Logging Bucket
  • Check: Configure log bucket retention
  • Risk: If logs are deleted too early, evidence is gone when you need it. Incidents and audit questions can no longer be answered.

Remediation via Google Cloud Console

  1. Log in to the Google Cloud Console and navigate to Monitoring > Logs Storage. Logs Storage page
  2. In the Log buckets table, find each bucket where the Retention period is less than 90 days.
  3. Click More actions next to the bucket and select Edit bucket. Edit log bucket
  4. Set Retention period to 90 days or more. Log bucket retention period
  5. Click Update bucket to apply the changes.
  6. Repeat steps 3 to 5 for every bucket with a shorter retention period.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and launch Cloud Shell. GCP Cloud Shell
  2. List the log buckets that keep logs for less than 90 days:

    gcloud logging buckets list \
    --filter="retentionDays<90" \
    --format="table(name,retentionDays)"
    
  3. Update the retention period of a bucket. Repeat for each bucket from the list:

    gcloud logging buckets update <BUCKET_ID> \
    --location=<LOCATION> \
    --retention-days=90
    

    Replace <BUCKET_ID> with the bucket name, for example _Default, and <LOCATION> with its location, for example global. Use a higher number of days if your policy requires it.

  4. Verify the retention period:

    gcloud logging buckets describe <BUCKET_ID> \
    --location=<LOCATION> \
    --format="value(retentionDays)"
    

Default Value

The _Default bucket and new user-defined buckets keep logs for 30 days. The _Required bucket keeps logs for 400 days and this cannot be changed. Keeping logs longer than 30 days adds storage cost.

Updated on 09 November, 2026