Filebeat inputs 这部分是监听哪些模块
Filebeat modules 这是模块 采集哪些项目
multiline.pattern: ^\[ #这部分是匹配多行的
#在这下载
https://www.elastic.co/cn/downloads/beats/filebeat
tar zxvf
mv
cd /usr/local/filebeat #放在这目录下
vim filebeat.yml
backoff: "1s" #一秒检查文件更新
endbled: true #代表启用这个模块
tail_files: false #重头开始读取,第二次就不会重头开始
paths:
- /usr/local/nginx/logs/access.log
------------------------------------------------不要看这个--------------------------------------------------------------
filebeat.inputs:
- type: log
enabled: true
backoff: "1s"
tail_files: false
paths:
- /usr/local/nginx/logs/access.log
#这部分是输出到elasticsearch
output.elasticsearch:
hosts: ["localhost:9200"]
#这部分是输出控制台
output.console:
enabled: true
------------------------------------------------------------------------------------------------------
或者这样写
type:system 是字段
tags 是字段
#启动 restart
systemctl start filebeat
backoff:设定多长时间检查文件更新。
tail_files:如果设置为true,则Filebeat将在每个文件的末尾而不是开头读取新文件。
当此选项与日志轮换结合使用时,可能会跳过新文件中的第一个日志条目。
vim filebeat.yml #看这个
filebeat.inputs:
- type: log
enabled: true
backoff: "1s"
tail_files: false
paths:
- /usr/local/nginx/logs/access.log
output.elasticsearch:
hosts: ["localhost:9200"]
#启动的 也可以使用后台nohup
./filebeat -e -c filebeat.yml -d "publish"
#找到的是位置信息 如果停掉,第二次就要找到位置信息
cd /usr/local/filebeat/data 或者 /export/filebeat7/data/registry/filebeat
#要删除
rm -rf *
./filebeat -e -c filebeat.yml
#elasticsearch 连接成功
#有索引了
curl http://127.0.0.1/abc.html