google-compute-engine - 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.
解决方案
您可以使用以下过滤器在stackdriver 日志记录中查看谁执行了创建任务:
resource.type="gce_instance" "创建"
您可以选择一个日志并将其展开以查看 VM 是由用户(电子邮件)还是由实例组管理器创建的。
注意:请记住,stackdriver 有日志的保留期。
推荐阅读
- c - 使用 strtok() 时出现硬故障
- django - 不存在于 /admin/
- java - 表 'DBNAME.hibernate_sequence' 不存在用于继承映射
- python - auth_registrations_mapping 错误:在具有管理员访问权限的 cmd 上 pip install twilio 时无法创建
- spring-boot - 如何添加多个消费者组?
- java - 使用 Lettuce 时重试 Redis 命令是否安全?
- php - 如何通过大摇大摆的发布请求发送原始正文?
- formset - 如何在表单向导的同一模板中创建表单审核页面
- java - 无法在标记为 @SpringBootTest 的组件测试中加载 @Configuration 类
- python - 如何知道在pygame中空格键是否按下超过2秒