Using Console
Using CLI
gsutil retention set <retention_period> gs://<bucket_name>
to set the retention policy for the log bucket. Replace <retention_period>
with the desired retention period in seconds, and <bucket_name>
with the name of the log bucket.gsutil retention get gs://<bucket_name>
to confirm that the retention policy has been set for the log bucket. Replace <bucket_name>
with the name of the log bucket.Using Python
your-bucket-name
with the name of the log bucket you want to set the retention policy on.
retention_period
with the desired retention period in seconds. For example, 604800 seconds is equivalent to 7 days.