Stanton
Stanton

Reputation: 495

GCP Object download metric

Is there a metric that can be used to determine how many times an object has been downloaded from a GCP bucket?

Upvotes: 1

Views: 379

Answers (2)

sotis
sotis

Reputation: 109

You can use the Audit logs to track storage activity from authenticated users.

For getting how many times an object has been viewed, you have to enable the DATA_READ access logs.

Then, you can search on the Logs Viewer using this advanced filter:

resource.type="gcs_bucket"
resource.labels.bucket_name=[BUCKET_NAME]
logName="projects/[project_id]/logs/cloudaudit.googleapis.com%2Fdata_access"
protoPayload.resourceName="projects/_/buckets/[bucket_name]/objects/[object_name]"

Note that this only works if the object has not public access.

Upvotes: 1

zkohi
zkohi

Reputation: 2520

It may be Metrics on Stackdriver Monitoring.

  • api/request_count
  • authz/acl_based_object_access_count
  • network/sent_bytes_count
  • etc

See https://cloud.google.com/monitoring/api/metrics_gcp?hl=ja#gcp-storage .

Upvotes: 1

Related Questions