Linux----------filebeat


環境:
192.168.1.1 Kibana ES Logstash
192.168.1.2 Filebeat

一、下載二進制包

cd /data/soft/
rz filebeat-6.8.0-linux-x86_64.tar.gz

二、二進制安裝

tar -xf filebeat-6.8.0-linux-x86_64.tar。gz
mv filebea-6.8.0 
cd filebeat/

三、配置filebeat發生日志到ES配置

vim /data/soft/filebeta-6.8.0/filebeat.yml
multiline.pattern: ^\[
multiline.negate: true
multiline.match: after
  paths:                            #收集的日志的路徑
      - /var/log/messages.log       #系統日志
      - /data/logs/nginx.log        #應用日志
reload.enabled: true
reload.period: 10s
tags: ["service-log"]
#output.elasticsearch:
#  hosts: ["localhost:9200"]
output.logstash:
    hosts: ["192.168.1.1:9200"]     #指定logstash的ip

四、啟動filebeat

前台啟動:/data/soft/filebeat/filebeat  -e -c /data/soft//filebeat/filebeat.yml
后台啟動:nohup /data/soft/filebeat/filebeat  -e -c /data/soft/filebeat/filebeat.yml >/data/logs/filebeat.log 2>&1 &

五、配置環境變量

echo 'export PATH=/data/soft/filebeat:$PATH' > /etc/profile.d/filebeat.sh
. /etc/profile.d/filebeta.sh
echo $PATH 

六、配置開啟腳本

vim /etc/init.d/filebeat
#!/bin/bash

# chkconfig: 2345 90 10
# description: filebeat

FB_HOME=/usr/local/ELK/filebeat-5.6.3-linux-x86_64
case $1 in
        start) sudo -iu hadoop $FB_HOME/filebeat -c $FB_HOME/filebeat/filebeat.yml&;;
        *) echo "filebeat start" ;;
esac

chmod +X /etc/init.d/filebeat
chkconfig --add filebeat


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM