london_utku
london_utku

Reputation: 1312

How to see Google Cloud Compute Engine Logs

How can I see the logs regarding the VMs that has been created on Google Cloud Compute Engine ?

Upvotes: 3

Views: 8310

Answers (1)

John Hanley
John Hanley

Reputation: 81336

Google Operations Logging (formerly Stackdriver) provides this information.

To see the details on Google Compute Engine instances that were created in a project, filter based upon the API operation v1.compute.instances.insert and the resouce type resource.type=gce_instance.

Note: the resouce type is not always necessary but it is best to be declarative in what logging should search for.

Example using the CLI:

gcloud logging read "resource.type=gce_instance protoPayload.methodName=v1.compute.instances.insert" --format json

Example using the Google Cloud Console - Legacy Logs Viewer

  • Go to https://console.cloud.google.com/logs/viewer

  • Verify that the desired Google Cloud project is displayed in the title area.

  • In the box showing the text "Filter by label or text search" click the dropdown and select "Convert to advanced filter".

  • In the box showing the text "Filter by label or text search" enter the following (as two lines in the filter box):

    resource.type="gce_instance"

    protoPayload.methodName="v1.compute.instances.insert"

  • Select the desired date search range in the box "Last hour"

  • Click the "Submit Filter" button

Example Filtered Search

Upvotes: 8

Related Questions