【问题标题】:Need Start and Stop times for GCP VM instances需要 GCP 虚拟机实例的启动和停止时间
【发布时间】:2020-09-06 16:04:42
【问题描述】:

使用 Google 云 AP,我想检索以下有关 VM 实例的数据

过去一个月内提供的谷歌实例的开始时间和停止时间。

有没有可能

【问题讨论】:

    标签: google-cloud-platform cloud


    【解决方案1】:

    Google Cloud AP 是什么意思?

    另一方面,您可以在 Cloud Logging 上获取 VM 的活动,有关您需要的信息,请转到 Cloud Logging 页面 convert to advance filter,您可以将此查询应用于启动操作:

    resource.type="gce_instance"
    "compute.instances.start"
    

    这用于停止操作:

    resource.type="gce_instance"
    "compute.instances.stop"
    

    您可以应用日期和时间过滤器以获得更好的结果。

    您也可以通过gcloud command获得相同的信息:

    gcloud 日志读取“jsonPayload.event_subtype = 计算.instances.stop"

    gcloud 日志读取“jsonPayload.event_subtype = 计算.instances.start"

    如需更多高级选项,请查看documentation.

    【讨论】:

      【解决方案2】:

      谢谢。这有帮助

      我可以使用日志记录 api

      https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list

      检索 VM 资源的开始和停止时间

      【讨论】:

      • 您好,如果答案有用,您可以在帖子中接受,这样如果其他用户有类似问题,他将能够更轻松地找到信息。
      猜你喜欢
      • 2020-01-19
      • 2014-12-12
      • 1970-01-01
      • 1970-01-01
      • 2022-07-09
      • 2021-09-08
      • 2021-01-20
      • 1970-01-01
      • 2021-01-10
      相关资源
      最近更新 更多