在 Debian 上 Filebeat 连不上(通常指连不上 Elasticsearch / Logstash / Kafka 等输出目标),原因很多。下面按最常见原因 → 排查方法 → 解决办法给你一个系统清单。
先看 Filebeat 日志(很重要):
journalctl -u filebeat -f
# 或
tail -f /var/log/filebeat/filebeat.log
常见报错关键词:
connection refusedno route to hosttimeoutx509: certificate signed by unknown authority401 Unauthorized403 Forbidden/etc/filebeat/filebeat.yml
❌ 错误示例:
output.elasticsearch:
hosts: ["localhost:9200"]
✅ 确认:
localhost9200测试连通性:
curl http://ES_IP:9200
Debian 上 Elasticsearch 默认只监听:
network.host: 127.0.0.1
✅ 改为:
network.host: 0.0.0.0
并重启 ES:
systemctl restart elasticsearch
⚠️ 注意:ES 7+ 需要设置:
discovery.type: single-node
Debian 常见:
iptables -L
ufw status
确保:
开放示例:
ufw allow 9200
如果你用的是 HTTPS:
output.elasticsearch:
hosts: ["https://es:9200"]
ssl.certificate_authorities: ["/etc/filebeat/ca.crt"]
错误:
x509: certificate signed by unknown authority
✅ 解决:
ca.crtssl.verification_mode: none
Elasticsearch 开了安全认证:
output.elasticsearch:
username: "elastic"
password: "xxx"
测试:
curl -u elastic:密码 http://ES:9200
systemctl status filebeat
如果失败:
filebeat test config
filebeat test output
date
timedatectl
不同步会导致证书校验失败。
filebeat test config
filebeat test output
这俩能直接告诉你配置对不对、能不能连。
你可以直接贴:
/etc/filebeat/filebeat.yml(脱敏)journalctl -u filebeat 报错我可以一步到位告诉你具体哪一行错了。