【问题标题】:Can't see pod logs from GKE in Cloud Logging在 Cloud Logging 中看不到来自 GKE 的 pod 日志
【发布时间】:2022-06-25 00:18:57
【问题描述】:

我有一个启用了 Cloud Logging 功能的 GKE 集群 v1.22。 screenshot

但我在日志资源管理器中看不到任何应用程序日志。

此外,我看不到 Google 用于将日志传输到 Cloud Logging 的 fluent-bit pod 的任何日志。 screenshot screenshot

它有一个在集群创建时自动创建的默认配置映射。

API 已在 GCP 中启用。

我找不到任何相关的手册和主题。

如果你能帮我处理,我会很高兴的。

更新:

I found this in fluentbit.log on the node:

[2022/06/08 08:41:45] [error] [parser] cannot parse '0608 08:41:45.986036' after %L
[2022/06/08 08:41:45] [ warn] [parser:glog] invalid time format %m%d %H:%M:%S.%L%z for '0608 08:41:45.986036'
[2022/06/08 08:41:45] [error] [parser] cannot parse '0608 08:41:45.986083' after %L
[2022/06/08 08:41:45] [ warn] [parser:glog] invalid time format %m%d %H:%M:%S.%L%z for '0608 08:41:45.986083'
[2022/06/08 08:41:45] [error] [parser] cannot parse '0608 08:41:45.986949' after %L
[2022/06/08 08:41:45] [ warn] [parser:glog] invalid time format %m%d %H:%M:%S.%L%z for '0608 08:41:45.986949'
[2022/06/08 08:41:45] [error] [parser] cannot parse '0608 08:41:45.987048' after %L
[2022/06/08 08:41:45] [ warn] [parser:glog] invalid time format %m%d %H:%M:%S.%L%z for '0608 08:41:45.987048'

parsers conf is:

[PARSER]
    Name        docker
    Format      json
    Time_Key    time
    Time_Format %Y-%m-%dT%H:%M:%S.%L%z

[PARSER]
    Name        containerd
    Format      regex
    Regex       ^(?<time>.+) (?<stream>stdout|stderr) [^ ]* (?<log>.*)$
    Time_Key    time
    Time_Format %Y-%m-%dT%H:%M:%S.%L%z

[PARSER]
    Name        json
    Format      json

[PARSER]
    Name        syslog
    Format      regex
    Regex       ^\<(?<pri>[0-9]+)\>(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$
    Time_Key    time
    Time_Format %b %d %H:%M:%S

[PARSER]
    Name        glog
    Format      regex
    Regex       ^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source_file>[^ \]]+)\:(?<source_line>\d+)\]\s(?<message>.*)$
    Time_Key    time
    Time_Format %m%d %H:%M:%S.%L%z

[PARSER]
    Name        network-log
    Format      json
    Time_Key    timestamp
    Time_Format %Y-%m-%dT%H:%M:%S.%L%z

【问题讨论】:

    标签: logging google-kubernetes-engine stackdriver fluent-bit


    【解决方案1】:

    检查您的应用程序是否向 stdout/stderr 写入任何内容:
    kubectl logs &lt;pod_name&gt;

    如果它没有返回任何内容,那么这就是为什么您在日志资源管理器中看不到任何容器日志的原因。

    如果它返回任何内容,请确保您没有任何 logging exclusions 可能过滤掉您的应用程序日志:
    在控制台菜单中找到 Operations 部分,然后转到 Logging->Logs Router
    接下来,在名为 _Default 的 Logs Router Sink 上单击 Dots(More actions)->Edit sink
    在那里,向下滚动到“选择日志以从接收器中过滤(可选)”,并确保没有任何带有以下表达式的排除过滤器:
    resource.type=("container" OR "k8s_container")
    resource.type="k8s_container" AND labels.k8s-pod/app="your_app_name"
    也没有任何其他类似的匹配您的应用程序。

    如果您发现任何内容,您可以禁用它们(或删除它们),稍等片刻,然后再次检查日志资源管理器。

    【讨论】:

      猜你喜欢
      • 2021-11-02
      • 1970-01-01
      • 2017-11-26
      • 2018-07-27
      • 1970-01-01
      • 2021-11-14
      • 2020-07-07
      • 2020-09-12
      • 2021-08-06
      相关资源
      最近更新 更多