首页 > 解决方案 > Find out why a machine was created

问题描述

Is there any way for a GCP Compute Engine instance to know if it was created by the Instance Group auto-scaling policy or if it was manually created?

On logs we generate on our instances we include the instance id. This is fine for manual instances that are started to test something, but it's not that useful for other instances as it clutters graphs of machine metrics.

In other words, for test machines we need the instance's id, but for other machines we need to log something else that's common to them all.

标签: google-compute-engine

解决方案


您可以使用以下过滤器在stackdriver 日志记录中查看谁执行了创建任务:

resource.type="gce_instance" "创建"

您可以选择一个日志并将其展开以查看 VM 是由用户(电子邮件)还是由实例组管理器创建的。

注意:请记住,stackdriver 有日志的保留期


推荐阅读