在 Debian 中,Filebeat 加密传输通常指两种方式:
下面以最常见的 Filebeat → Elasticsearch(或 Logstash)TLS 加密 为例说明。
通常需要:
ca.crt)将 CA 证书放到:
/etc/filebeat/certs/ca.crt
编辑 /etc/filebeat/filebeat.yml:
output.elasticsearch:
hosts: ["https://es-node1:9200"]
username: "filebeat_writer"
password: "your_password"
ssl:
enabled: true
certificate_authorities: ["/etc/filebeat/certs/ca.crt"]
# 如果 ES 要求客户端证书
# certificate: "/etc/filebeat/certs/filebeat.crt"
# key: "/etc/filebeat/certs/filebeat.key"
filebeat test output
systemctl restart filebeat
input {
beats {
port => 5044
ssl => true
ssl_certificate => "/etc/logstash/certs/logstash.crt"
ssl_key => "/etc/logstash/certs/logstash.key"
ssl_certificate_authorities => ["/etc/logstash/certs/ca.crt"]
}
}
output.logstash:
hosts: ["logstash:5044"]
ssl:
enabled: true
certificate_authorities: ["/etc/filebeat/certs/ca.crt"]
output.kafka:
hosts: ["kafka1:9093"]
topic: "logs"
ssl:
enabled: true
certificate_authorities: ["/etc/filebeat/certs/ca.crt"]
如果是 Elastic Stack:
/usr/share/elasticsearch/bin/elasticsearch-certutil ca
/usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
然后分发 ca.crt 给 Filebeat。
x509: certificate signed by unknown authority
✅ 确认 certificate_authorities 路径正确
确保 CA 已正确导入 Filebeat 信任链
journalctl -u filebeat -f
如果你能提供:
我可以给你一份可直接用的配置模板。