Skip to content

Log 集合失败

错误信息

                错误: Fluentd 失败到 发送 logs 到 Elasticsearch
              

快速摘要

log collector (Fluentd, Filebeat) cannot 向前 logs 到 storage backend, resulting in missing or delayed logs.

为什么发生

  • log storage backend (Elasticsearch, Loki) 是 unavailable

  • log collector 是不 运行 or 是 misconfigured

  • Network issues prevent collector 从 reaching log 存储

  • log 存储是 完整 or 有 insufficient disk 空间

最小示例

✗ 错误代码
# Fluentd cannot send to Elasticsearch
# Error: connection refused to elasticsearch:9200
✓ 修复代码
# Check and restart Elasticsearch
kubectl get pods -l app=elasticsearch
kubectl rollout restart deployment/elasticsearch
# Then restart Fluentd
kubectl rollout restart daemonset/fluentd

Elasticsearch 是下, 所以 Fluentd cannot 发送 logs. fix restarts Elasticsearch and 然后 Fluentd.

如何诊断

  • 检查如果 log collector 是运行: kubectl 获取 pods -l app=fluentd

  • View collector logs for 错误: kubectl logs <fluentd-pod>

  • 验证 log 存储是 运行 and reachable

  • 检查 disk 空间 on log storage backend

如何修复

  • 重启 log collector: kubectl rollout 重启 daemonset/fluentd

  • Fix log 存储连接 (重启 Elasticsearch, fix network)

  • 正确 collector 配置 (URL, credentials, 索引)

  • Free 上 disk 空间 on log 存储 or increase retention rotation

如何预防

  • Monitor log 集合 health and alert on failures

  • Use buffer/queue in collector 到 handle log 存储 outages

  • 设置 log retention policies 到 prevent disk 完整 issues

相关资源

← 返回语言