Filebeat 在 Debian 上“连接失败”通常体现在日志里类似:
connection to ... faileddial tcp ...: connection refusedfailed to connect to backoffx509: certificate signed by unknown authority下面按最常见原因逐一说明,你可以对照排查。
systemctl status elasticsearch
systemctl status logstash
举例(Elasticsearch 输出):
output.elasticsearch:
hosts: ["http://localhost:9200"]
常见问题:
https 但实际是 http测试连通性:
curl -v http://localhost:9200
Debian 本地:
iptables -L
ufw status
远程服务器:
telnet 192.168.1.10 9200
如果你用的是:
output.elasticsearch:
hosts: ["https://es:9200"]
ssl.certificate_authorities: ["/etc/filebeat/ca.crt"]
常见错误:
ca.crt 路径不对查看错误:
journalctl -u filebeat -f
临时排查可加:
ssl.verification_mode: none
(仅测试,不建议生产)
Elasticsearch 开了安全:
xpack.security.enabled: true
Filebeat 必须配置用户名密码:
output.elasticsearch:
username: "filebeat"
password: "xxxx"
或 Logstash:
output.logstash:
hosts: ["localhost:5044"]
systemctl status filebeat
journalctl -u filebeat -n 100
重启:
systemctl restart filebeat
检查配置:
filebeat test config
filebeat test output
Debian 默认无 SELinux,但注意:
/var/lib/filebeat/ 权限/etc/filebeat/ 权限ls -l /etc/filebeat/filebeat.yml
systemctl status filebeatfilebeat test outputcurl http://目标IP:端口filebeat.yml 的 hostsjournalctl -u filebeat如果你愿意,可以把 filebeat.yml 的 output 部分 + 报错日志 贴出来,我可以直接帮你定位是哪一类问题。