beats是ELK体系中新增的一个工具,, 属于一个轻量的日志采集器。
1.安装(每台)
# tar xf filebeat-6.4.1-linux-x86_64.tar.gz
# mv filebeat-6.4.1-linux-x86_64 /usr/local/filebeat
#yum -y install httpd
#systemctl start httpd
2.测试filebeat正常运行
# cd /usr/local/filebeat/
# vim filebeat.yml
filebeat.inputs: - type: log #enabled: false #这一句要注释掉,或改为true paths: - /var/log/httpd/access_log #指定收集的日志文件路径 #output.elasticsearch: #先将这几句注释掉 #hosts: ["192.168.148.133:9200"] #配置es服务器的ip地址 output.console: #终端输出的测试 enable: true
# ./filebeat -c filebeat.yml
#新建窗口访问httpd服务,测试终端会收集日志数据
3.测试完成后,修改配置文件,让filebeat以服务的方式启动
# vim filebeat.yml
#output.console: #把这两句注释掉 # enable: true output.elasticsearch: hosts: ["192.168.148.132:9200"] #只需写一台主机,集群会自动分片到其他机器
# jobs ;kill %1
# ./filebeat -c filebeat.yml &
4.启动成功后, 到es服务器上查看索引
# curl 192.168.148.132:9200/_cat/indices?
可以看到新增了一个以filebeat开头的索引, 这就代表filesbeat和es能够正常通信了