Review Cloud Storage usage logging

Distinguish Cloud Storage usage logs from Cloud Audit Logs and verify collection and delivery of the access records you need.

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.logBucket to 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.com the roles/storage.objectCreator role. 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.

References