Description
Cloud Storage writes request details to usage logs and storage consumption to storage logs. These CSV files complement Cloud Audit Logs when you need details such as access to public objects.
Potential impact
Usage logs can be late or incomplete. A delivery failure can leave gaps in a request history.
Remediation
- Use Cloud Audit Logs for API auditing. To collect the CSV files as well, set
spec.logging.logBucketto a bucket in the same location and organization. Without an organization, use the same project. With VPC Service Controls, use the same security perimeter. - On the destination, grant
cloud-storage-analytics@google.comtheroles/storage.objectCreatorrole. Restrict readers, set retention, and verify that files arrive after a test request.
Examples
These excerpts use storage.gcp.crossplane.io/v1alpha3. Create the log bucket separately.
Before
yaml
apiVersion: storage.gcp.crossplane.io/v1alpha3
kind: Bucket
spec:
location: EU
storageClass: MULTI_REGIONAL
After
yaml
apiVersion: storage.gcp.crossplane.io/v1alpha3
kind: Bucket
spec:
location: EU
logging:
logBucket: example-logs-bucket
storageClass: MULTI_REGIONAL
The revised manifest sends the logs to example-logs-bucket.