Search code examples
google-cloud-platformgoogle-cloud-storagegoogle-cloud-logging

GCS Bucket not logging pixel/file requests


I have a simple Google Cloud Storage bucket set up that contains one file, pixel.png with a publicly accessible url that is working.

When I go into Stackdriver logging, none of the pixel requests are being tracked... the only thing in the logs are the admin changes I make to the bucket itself:

grid with only folder admin records

I'm sure it's something simple... The logs for my AppEngine app records every single image request by my app, I'd like to set the bucket up the same way - to see each request for pixel.png.


Solution

  • When working with Cloud Audit logging for Google Cloud Storage, it is important to read this page in detail: Cloud Audit Logging with Cloud Storage. For your particular puzzle, it is important to realize that Audit Logging is switched off by default. To switch it on you should visit IAM & admin > Audit Logging in the GCP console and switch it on for Cloud Storage. The second thing that I noted in your question was that the object in question may be public? There is a caveat in the audit logging for cloud storage which reads:

    Cloud Audit Logging does not track access to public objects.

    So if the object in question is public, access is not reported by Cloud Audit logging.