Search code examples
google-cloud-platformbucket

GCP Storage Bucket Access Logs


If you set a storage bucket as a static website, is there any way to trace who has accessed it? e.g. IP addresses, time viewed etc...

I have looked in the stackdriver logs but it only shows events e.g. bucket created, files uploaded etc...


Solution

  • You will need to configure access logs for public buckets. Then you may import them into BigQuery for analysis.

    Use Access and Storage logs if:

    • You want to track access to public objects, such as assets in a bucket that you've configured to be a static website.

    You'll be able to get all the information required such as IP address, time, region, zone, headers, read/write ops etc. in the access log fields.

    https://cloud.google.com/storage/docs/access-logs