PaulZ
PaulZ

Reputation: 11

How to see the activity history of a resource on Google Cloud Platform (GCP)?

How do I see the history of a resource/asset on GCP?

For example I have a compute instance instance1, and I want to know what config change has been made to it in the past few days.

Upvotes: 1

Views: 4323

Answers (2)

Daniel
Daniel

Reputation: 63

You can achieve that using Cloud Asset Inventory.

In particular, they have an API to view asset history given an asset.

In your case, you can do

gcloud asset get-history --project='$PROJECT_ID' \
  --asset-names='//compute.googleapis.com/projects/$PROJECT_ID/zo\
nes/$ZONE/instances/$INSTANCE' \
  --start-time='2020-06-01T12:00:23.000Z' \
  --end-time='2020-06-04T13:01:21.045Z' \
  --content-type='resource'

Upvotes: 1

ingernet
ingernet

Reputation: 1524

Okay, so there are two resources that may come in handy for you. Not sure if you're working on the command line or the console, but here's one way to see activity logs on a compute instance: https://cloud.google.com/compute/docs/logging/activity-logs

Apparently it will be deprecated in the future, though, so you might want to just go straight to the audit logs: https://cloud.google.com/compute/docs/logging/audit-logging

Good luck!

Upvotes: 1

Related Questions