0

I have a cloudsql instance Im not sure who created or when.

How can I see when a cloudsql instance was created so I can know how old it is? I see nothing in the UI with created date or anything like that.

red888
  • 4,183
  • 18
  • 64
  • 111

1 Answers1

3

If you click on 'Operations' in the left CloudSQL menu, it should have a list of all operations your database instance is currently running and has completed, the very first on should be of type "Create" and should have a timestamp.

UPD: you can also try to get this info with gcloud command:
gcloud sql operations list --instance <instance_name> --filter='operationType=CREATE'

jabbson
  • 720
  • 2
  • 9
  • That command is great BUT im trying to get this info with stack driver logs now because the stack driver log will include more info like who actually created it. but it seems like stack driver doesnt keep these logs forever? so if you have an instance thats over a year old it wont show up? – red888 Mar 05 '21 at 21:29
  • also possible with gcloud: `gcloud sql operations list --instance --filter='operationType=CREATE' --format='table(name,operationType,startTime,endTime,user)'` – jabbson Mar 05 '21 at 22:11
  • 1
    To answer your question regarding the Cloud Logging, it is also possible, activity logs by default end up in the _Required Log Router sink which are stored for 400 days. If you would like to store something for longer, you can create your own sink and have a custom retention policy around how, where and for how long to store such logs. Just in case, the filter to use to query the 'cloudsql.instance.create' logs from the default log file is as follows: ```resource.type="cloudsql_database" logName="projects//logs/cloudaudit.googleapis.com%2Factivity"``` – jabbson Mar 05 '21 at 22:37