And*_*eig 1 google-cloud-platform
我们注意到,我们的一些 GCE 实例在 /home/deploy/.config/gcloud/logs
(“deploy”是我们的应用程序进程运行的用户)下积累了大量日志文件(1.6GB)。看来保存了一个月的日志文件。每隔几秒左右就会创建一个文件。
每个文件如下所示:
2020-12-11 20:52:02,105 DEBUG root Loaded Command Group: ['gcloud', 'config', 'config_helper']
2020-12-11 20:52:02,107 DEBUG root Running [gcloud.config.config-helper] with arguments: [--format: "json", --verbosity: "none"]
2020-12-11 20:52:02,130 DEBUG google_auth_httplib2 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/xxx/?recursive=true
2020-12-11 20:52:02,137 DEBUG google_auth_httplib2 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/xxx/token
2020-12-11 20:52:02,157 INFO root Display format: "default json"
2020-12-11 20:52:02,159 INFO ___FILE_ONLY___ {
"configuration": {
"active_configuration": "default",
"properties": {
"core": {
"account": "xxx",
"disable_usage_reporting": "True",
"project": "xxx",
"verbosity": "none"
}
}
},
"credential": {
"access_token": "xxx",
"id_token": "xxx",
"token_expiry": "2020-12-11T21:36:39Z"
},
"sentinels": {
"config_sentinel": "/home/deploy/.config/gcloud/config_sentinel"
}
}
2020-12-11 20:52:02,159 INFO ___FILE_ONLY___
2020-12-11 20:52:02,160 DEBUG root SDK update checks are disabled.
Run Code Online (Sandbox Code Playgroud)
(我删除了潜在的敏感信息。)
我试图找出这些文件的来源,更重要的是,如何防止它们被创建。这些文件占用了大量的磁盘空间。
这些是ubuntu系统。我们的应用程序主要是用 Go 编写的,并带有一些 Ruby 和 Node.js。
小智 5
这些日志由 gcloud 自动生成,并在 30 天内自动清除。您可以在云 shell 上使用以下命令来禁用它。
gcloud 配置集 core/disable_file_logging True
您可以在GCP 官方文档中了解有关该命令的更多信息。
归档时间: |
|
查看次数: |
503 次 |
最近记录: |