π‘οΈ Google Logging Log Sink exports logs to a Storage Bucket without Bucket Lockπ’
- Contextual name: π‘οΈ og Sink exports logs to a Storage Bucket without Bucket Lockπ’
- ID:
/ce/ca/google/logging/storage-bucket-retention-policy - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicβ
- π§ prod.logic.yamlπ’
Similar Policiesβ
- Cloud Conformity: Configure Retention Policies with Bucket Lock
Descriptionβ
Descriptionβ
Enabling retention policies on log buckets protects logs stored in Cloud Storage buckets from being overwritten or accidentally deleted. It is recommended to set up retention policies and configure Bucket Lock on all storage buckets that are used as log sinks.
Rationaleβ
Logs can be exported by creating one or more sinks that include a log filter and a destination. As Cloud Logging receives new log entries, they are compared against each sink. If a log entry matches a sink's filter, then a copy of the log entry is written to the destination.
Sinks can be configured to export logs to storage buckets. It is recommended to configure a data retention policy for these Cloud Storage buckets and lock the retention policy, which permanently prevents the policy from being reduced or removed. This way, if the system is compromised by an attacker or a malicious insider who wants to cover their tracks, the activity logs are preserved for forensics and security investigations.
Impactβ
Locking a bucket is an irreversible action. Once you lock a bucket, you cannot remove the retention policy from the bucket or decrease the retention period for the policy. You will then have to wait for the retention period for all items within the bucket before you can delete them, and then the bucket.
... see more
Remediationβ
Remediationβ
From Google Cloud Consoleβ
- If sinks are not configured, first follow the instructions in the recommendation:
Ensure that sinks are configured for all Log entries.- For each storage bucket configured as a sink, go to the Cloud Storage browser at
https://console.cloud.google.com/storage/browser/{{bucket-name}}.- Select the Bucket Lock tab near the top of the page.
- In the Retention policy entry, click the Add Duration link. The
Set a retention policydialog box appears.- Enter the desired length of time for the retention period and click
Save policy.- Set the
Lock statusfor this retention policy toLocked.From Google Cloud CLIβ
To list all sinks destined to storage buckets:
gcloud logging sinks list \
--folder={{folder-id}}
gcloud logging sinks list \
--organization={{organization-id}}
gcloud logging sinks list \
--project={{project-id}}For each storage bucket listed above, set a retention policy and lock it:
gsutil retention set {{time-duration}} gs://{{bucket-name}}... see more