Ubuntu Filebeat远程日志收集步骤如下:
安装Filebeat
sudo apt update && sudo apt install filebeat 配置远程日志路径
编辑配置文件 /etc/filebeat/filebeat.yml,在 filebeat.inputs 中指定远程日志路径(支持通配符):
filebeat.inputs: - type: log enabled: true paths: - /var/log/remote/*.log # 远程服务器日志路径(需通过其他方式将日志同步至此,如rsync) 配置远程输出目标
output.elasticsearch 配置远程集群地址:output.elasticsearch: hosts: ["es-server1.example.com:9200", "es-server2.example.com:9200"] output.logstash 并指定Logstash地址:output.logstash: hosts: ["logstash-server:5044"] 启动服务并验证
sudo systemctl start filebeat sudo systemctl enable filebeat sudo journalctl -u filebeat -f # 查看日志确认运行状态 说明:
rsync、scp 等工具将日志同步到本地指定路径(如 /var/log/remote/),再由Filebeat采集。input.type: tcp/udp 配置远程日志推送,但需自行处理协议解析。