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 policy
dialog box appears. - Enter the desired length of time for the retention period and click
Save policy
. - Set the
Lock status
for this retention policy toLocked
.
From Google Cloud CLIβ
-
To list all sinks destined to storage buckets:
gcloud logging sinks list --folder=FOLDER_ID | --organization=ORGANIZATION_ID | --project=PROJECT_ID
-
For each storage bucket listed above, set a retention policy and lock it:
gsutil retention set [TIME_DURATION] gs://[BUCKET_NAME] gsutil retention lock gs://[BUCKET_NAME]
For more information, visit https://cloud.google.com/storage/docs/using-bucket-lock#set-policy.