使用Filebeat监控CentOS服务器步骤如下:
安装Filebeat
wget下载后,执行sudo rpm -ivh filebeat-*.rpm安装。sudo yum install filebeat -y。配置Filebeat
编辑配置文件/etc/filebeat/filebeat.yml:
filebeat.inputs中添加要监控的日志路径,如paths: ["/var/log/*.log"]。output.elasticsearch(需指定Elasticsearch地址、端口、索引名等),或output.logstash(若需经Logstash处理)。ignore_older忽略旧日志、exclude_files排除特定文件等。启动并启用服务
sudo systemctl start filebeat。sudo systemctl enable filebeat。验证运行状态
sudo systemctl status filebeat。sudo tail -f /var/log/filebeat/filebeat,确认日志采集正常。可视化监控(可选)
注意事项:
参考来源: