简体   繁体   中英

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?

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

过滤搜索示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM