gpt4 book ai didi

kubernetes - 提取容器 ID 时出错 - 源值不包含匹配器的 logs_path '/var/lib/docker/containers/'

转载 作者:行者123 更新时间:2023-12-02 12:00:59 24 4
gpt4 key购买 nike

我在 kubernetes 集群中使用 filebeat 收集容器的日志,现在收集的日志显示此错误:

2020-06-10T09:26:35.831Z ERROR [kubernetes] add_kubernetes_metadata/matchers.go:91 Error extracting container id - source value does not contain matcher's logs_path '/var/lib/docker/containers/'.

这是完整的日志输出:

enter image description here

我发现 filebeat 正在监听的是节点 meowk8sslave2 并登录到该节点发现路径存在。为什么会发生错误?这是我的 filebeat 配置:

{
"filebeat.yml": "filebeat.inputs:
- type: container
paths:
- /var/log/containers/*.log
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: \"/var/log/containers/\"

output.elasticsearch:
host: '${NODE_NAME}'
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
"
}

最佳答案

在您的 filebeat pod 中查看日志可用的确切位置。

我在 Minikube 上测试 ELK 堆栈。

在我的例子中它在 /var/lib/docker/containers/*/*.log

所以这个对我有用。

filebeatConfig:
filebeat.yml: |
filebeat.inputs:
- type: container
paths:
- /var/lib/docker/containers/*/*.log
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: "/var/lib/docker/containers/"
output.elasticsearch:
host: '${NODE_NAME}'
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'

关于kubernetes - 提取容器 ID 时出错 - 源值不包含匹配器的 logs_path '/var/lib/docker/containers/',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62302527/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com