Skip to main content
Five Steps for Cloud Compliance Readiness·A practical playbook for security teamsDownload
CIS Google Cloud Platform Foundation v5.0.0 · 2.4

Log-export storage buckets should have a locked retention policy

  • Level 2
  • Logging and Monitoring

This check looks at the Cloud Storage buckets that receive exported audit and other logs and whether they carry a retention policy that has been locked. The safe setting is a locked policy, so exported logs cannot be deleted or overwritten until the retention period has passed.

Why it matters

Exported logs are the record you rely on after an incident. If someone with storage permissions can delete or replace the objects, they can also erase the trail of what they did. A retention policy stops deletion and replacement of objects younger than the period you set, and locking it makes the policy permanent, so even a project owner cannot shorten or remove it.

A retention policy also helps when logs are needed long after the people who created them have moved on, because the objects stay readable and unchanged for the whole period. Keep in mind that it protects the stored copy only; the original logs in Cloud Logging follow their own retention settings.

Google describes the feature in Bucket Lock and the export destinations in Configure and manage sinks.

How to check it yourself

Console path: Google Cloud console, Logging, Log Router, note the destination bucket of each Cloud Storage sink. Then open Cloud Storage, Buckets, the bucket, Protection tab, and read the Retention policy section: it should show a retention period and say it is locked.

Read-only gcloud commands:

gcloud logging sinks list --project=<project-id> --format="table(name,destination)"
gcloud storage buckets describe gs://<log-bucket> --format="yaml(retentionPolicy)"

In the output, isLocked: true means the policy is locked. No retentionPolicy block means there is none. Both commands only read metadata.

How to fix it

Console steps: Cloud Storage, Buckets, open the log bucket, Protection tab, Set retention policy, choose the period your organization wants to keep logs, save, and then choose Lock. Locking cannot be undone.

Script (replace the placeholders; set the policy first and lock only once you are sure of the period):

gcloud storage buckets update gs://<log-bucket> --retention-period=<period, e.g. 365d>
gcloud storage buckets update gs://<log-bucket> --lock-retention-period

ConfigCobra itself only reads your Google Cloud projects and shows the fix; it never applies it.

What changes when you fix it

Objects in the bucket can no longer be deleted or overwritten until each one is older than the retention period, by anyone, and a locked period can be lengthened but never shortened or removed. A bucket with a locked policy cannot be deleted until its objects have aged out, and you keep paying for storage during that time, so choose the period carefully and pick the storage class with that in mind. Log sinks keep writing new objects as before. Teams who used lifecycle rules to delete old logs sooner than the new period will find those deletions blocked.

ConfigCobra's remediation impact analysis lists the affected resources before you apply a fix.

Included in

BenchmarkCIS IDProfile
CIS Google Cloud Platform Foundation v5.0.02.4Level 2

Check this on your Google Cloud

ConfigCobra runs this check with every other control of the CIS Google Cloud Platform Foundation Benchmark, read-only.

Get in touch

Let's talk.

Whether you're evaluating ConfigCobra, running an audit, or managing a client fleet — we respond within one business day.

Free trial