Description
Cloud Audit Logs covers most API auditing. A bucket’s logging setting adds usage logs for requests, including public-object reads, and storage logs for capacity.
Potential impact
Late or missing usage records can make it hard to trace who accessed an object.
Remediation
Set logging.logBucket to a bucket in the same location and organization as the source, or the same project if there is no organization. Grant cloud-storage-analytics@google.com the roles/storage.objectCreator role there. Limit log access and retention and check for delivered objects.
Examples
Define the destination bucket resource accessLogs separately.
Before
resources:
example:
type: gcp:storage:Bucket
properties:
location: US-CENTRAL1
After
resources:
example:
type: gcp:storage:Bucket
properties:
location: US-CENTRAL1
logging:
logBucket: ${accessLogs.name}
logObjectPrefix: some_obj_prefix
The revised resource uses ${accessLogs.name} as the destination and some_obj_prefix as the log object prefix.