- 安装Filebeat:通过YUM安装,命令为
sudo yum install filebeat。 - 配置日志路径:编辑
/etc/filebeat/filebeat.yml,在filebeat.inputs中指定应用日志路径,如paths: ["/var/log/myapp/*.log"]。 - 配置输出目标:在
output.elasticsearch中设置Elasticsearch地址,如hosts: ["localhost:9200"]。 - 启动服务:执行
sudo systemctl start filebeat并设置开机自启sudo systemctl enable filebeat。 - 验证运行:通过
sudo journalctl -u filebeat -f查看日志,或在Kibana中确认数据是否正常接收。