Ubuntu18.04系统安装filebeat
下载filebeat安装包
访问Elastic官方网站,找到适用于Ubuntu18.04的filebeat安装包。可以使用wget命令下载:
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.10.0-amd64.deb
安装filebeat
使用dpkg命令安装下载的.deb包:
sudo dpkg -i filebeat-7.10.0-amd64.deb
配置filebeat
安装完成后,编辑filebeat的配置文件:
sudo nano /etc/filebeat/filebeat.yml
在配置文件中,设置要收集的日志文件路径和输出目标(如Elasticsearch或Logstash)。
启动filebeat服务
配置完成后,启动filebeat服务:
sudo systemctl start filebeat
设置filebeat开机自启:
sudo systemctl enable filebeat
验证filebeat运行状态
检查filebeat服务状态:
sudo systemctl status filebeat
如果看到"active (running)",说明filebeat已成功启动。
troubleshooting
如遇到问题,查看filebeat日志:
sudo journalctl -u filebeat
根据日志信息排查配置或权限问题。
结语
完成以上步骤后,filebeat将在Ubuntu18.04系统上正常运行,收集指定的日志文件并发送到配置的输出目标。定期检查filebeat状态和日志,确保日志收集工作持续有效进行。