filebeat

filebeat安装

下载

wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.4.0-linux-x86_64.tar.gz

安装:

cd /usr/local/ 
tar -xvzf filebeat-5.4.0-Linux-x86_64.tar.gz 
ln -s filebeat-5.4.0-linux-x86_64 filebeat 
cd filebeat 
rm logs 
rm -rf logs 
mkdir 
ln -s /data/filebeat_log/ logs 
mkdir mkdir /data/filebeat_data 
ln -s /data/filebeat_data /usr/local/filebeat/data

配置

vim filebeat.sh

#设置输入
filebeat.prospectors:
#文件路径,可以使用正则匹配
  - paths: ["/data/logs/catalina_logs/localhost_access_log.*.txt"]
#打个tag
    tags: ["accesslog"]
#使用json格式进行识别
    json.keys_under_root: true
#设置输出到redis里面
output:
  redis:
  #ip
    hosts: ["100.115.142.246"]
    #密码
    password: "foobared"
    #key
    key: "tomcat_access_log"
    #数据库名
    db: 5
    #超时时间
    timeout: 5
    #输出为json格式
  template.enabled: true
  template.path: "filebeat.template.json"
  template.overwrite: false

启动

nohup /usr/local/filebeat/filebeat -c /usr/local/filebeat/filebeat.yml -path.logs /usr/local/filebeat/logs/ & 
-c:配置文件位置 
-path.logs:日志位置 
-path.data:数据位置 
-path.home:家位置 
-e:关闭日志输出

原文地址:https://www.cnblogs.com/yangxiaochu/p/7390064.html