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