-2

I have python code, calling an API to list all my instances. Here's the API I'm calling. https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

However, I can't seem to locate the logs in log explorer. In AWS this was pretty straightforward. Any idea where GCP surfaces them?

chickenman
  • 728
  • 2
  • 9
  • 29
  • Have you looked into Google Cloud Logging? What do you mean by surfaced? Which logs are you interested in - OS, Application, Audit, or Usage? You can export logs to a Cloud Storage bucket or use APIs to access them. For VM OS and application logs, you must install the Cloud Logging Agent. This [intro](https://cloud.google.com/logging) page will get you started. Cloud Logging is part of a larger suite of tools called [Operations Suite](https://cloud.google.com/products/operations?hl=en). – John Hanley Jul 28 '23 at 22:36
  • I am trying to fetch the audit logs (i.e, someone called a get API on my resources) – chickenman Jul 31 '23 at 12:31

1 Answers1

0

To access audit logs for a call to v1.compute.instances.insert run the following query in the Logs Explorer:

protoPayload.@type="type.googleapis.com/google.cloud.audit.AuditLog"
protoPayload.methodName="v1.compute.instances.list"