如何解决Cloud Logging 不适用于运行容器的容器优化操作系统
我正在容器优化操作系统下的 GCE 实例上运行 Docker 容器。我遵循了本手册 https://cloud.google.com/container-optimized-os/docs/how-to/logging 并添加了 google-logging-enabled
元数据值以启用将容器的日志发送到 Cloud Logging:
但它不起作用。我在 Cloud Logging 中看不到容器的日志:
虽然我在现实中有很多容器日志:
如何使其工作并将容器的日志真正发送到 Cloud Logging?
更新
日志过滤器是默认的过滤器:(resource.type="gce_instance" AND resource.labels.instance_id="***") OR (resource.type="global" AND jsonPayload.instance.id="***")
这意味着应该显示当前实例的所有类型的日志。
解决方法
我的问题是与实例关联的服务帐户没有 const normalTuple = [1,2,3] as const;
const neverMatches = normalTuple.find<string>((b) => b > 3); //undefined;
const hasMatch = normalTuple.find<number>((b) => b > 3); //1 | 2 | 3 | undefined;
权限。我发现通过运行显示以下内容的 never | undefined
命令:
undefined
通过谷歌搜索错误消息,我在 GitHub 问题 https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/issues/295
中找到了答案以下答案也帮助我诊断了问题:https://stackoverflow.com/a/65768214/8016720
现在我在 Cloud Logging 中拥有我想要的所有日志。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。