【问题标题】:GCP MIG Container Logs To GCS BucketGCP MIG 容器日志到 GCS 存储桶
【发布时间】:2021-11-09 10:17:42
【问题描述】:

在我的 GCP 项目中,我有 MIG 托管用于 Spring Boot 的 docker 容器。 目前,来自 Spring Boot 应用程序的日志驻留在容器中,要访问这些日志,我必须运行以下命令。

docker logs <container_id>

我需要从容器中提取日志并将其导出到 GCS Bucket。

GCP 中是否有任何内置解决方案,或者我是否需要在 Vms 中安装 fluentd 并使用它将容器日志导出到 GCS Bucket?

【问题讨论】:

标签: docker google-cloud-platform


【解决方案1】:

您可以通过创建一个或多个包含过滤器表达式和目标的接收器来路由日志。

您可以在同一 Cloud 项目内或 Cloud 项目之间路由日志的受支持目的地有多种类型,它们是:

1.Cloud Storage: JSON files stored in Cloud Storage buckets.

2.Pub/Sub: JSON messages delivered to Pub/Sub topics. Supports third-party integrations, such as Splunk, with Logging.

3.BigQuery: Tables created in BigQuery datasets.

4.Another Cloud Logging bucket: Log entries held in Cloud Logging log buckets.

您可以使用 Cloud Console 或 gcloud 命令行工具在 Cloud 项目中创建接收器。

但在创建接收器之前,您需要为您从中发送日志的源 Cloud 项目拥有以下 IAM 角色之一。

1.Owner (roles/owner)
2.Logging Admin (roles/logging.admin)
3.Logs Configuration Writer (roles/logging.configWriter)

更多详情请参考doc

【讨论】:

    猜你喜欢
    • 2020-09-17
    • 2022-10-16
    • 1970-01-01
    • 2021-02-21
    • 2015-08-18
    • 1970-01-01
    • 2022-06-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多