【问题标题】:How to see Google Cloud Compute Engine Logs如何查看 Google Cloud Compute Engine 日志
【发布时间】:2021-01-17 21:36:15
【问题描述】:

如何查看有关已在 Google Cloud Compute Engine 上创建的 VM 的日志?

【问题讨论】:

    标签: google-cloud-platform google-compute-engine stackdriver google-cloud-stackdriver google-cloud-logging


    【解决方案1】:

    Google Operations Logging(以前称为 Stackdriver)提供此信息。

    要查看项目中创建的 Google Compute Engine 实例的详细信息,请根据 API 操作 v1.compute.instances.insert 和资源类型 resource.type=gce_instance 进行过滤。

    注意:资源类型并不总是必需的,但最好在日志记录应搜索的内容中声明。

    使用 CLI 的示例:

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

    使用 Google Cloud Console 的示例 - 旧版日志查看器

    • 转到https://console.cloud.google.com/logs/viewer

    • 验证所需的 Google Cloud 项目是否显示在标题区域中。

    • 在显示文本“按标签或文本搜索过滤”的框中,单击下拉菜单并选择“转换为高级过滤器”。

    • 在显示文本“按标签或文本搜索过滤”的框中输入以下内容(过滤框中的两行):

      resource.type="gce_instance"

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

    • 在“上一小时”框中选择所需的日期搜索范围

    • 点击“提交过滤器”按钮

    【讨论】:

      猜你喜欢
      • 2020-05-28
      • 2021-08-06
      • 1970-01-01
      • 2019-10-15
      • 1970-01-01
      • 1970-01-01
      • 2020-04-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多