阅读量:4
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) -
配置远程输出目标
- 输出到远程Elasticsearch:修改
output.elasticsearch配置远程集群地址:output.elasticsearch: hosts: ["es-server1.example.com:9200", "es-server2.example.com:9200"] - 输出到Logstash(需先安装Logstash):修改为
output.logstash并指定Logstash地址:output.logstash: hosts: ["logstash-server:5044"]
- 输出到远程Elasticsearch:修改
-
启动服务并验证
sudo systemctl start filebeat sudo systemctl enable filebeat sudo journalctl -u filebeat -f # 查看日志确认运行状态
说明:
- 若需采集远程服务器日志,需先通过
rsync、scp等工具将日志同步到本地指定路径(如/var/log/remote/),再由Filebeat采集。 - 支持多协议输入(如TCP/UDP),可通过
input.type: tcp/udp配置远程日志推送,但需自行处理协议解析。
以上就是关于“Ubuntu Filebeat如何进行远程日志收集”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm