文章詳情頁(yè)
filebeat同時(shí)收集錯(cuò)誤日志與普通日志并存詳解
瀏覽:219日期:2023-03-13 15:37:37
目錄
- 1.配置filebeat收集error日志
- 2.查看es是否產(chǎn)生error索引
- 3.在kibana上關(guān)聯(lián)es索引
- 4.在kibana上統(tǒng)計(jì)錯(cuò)誤日志
1.配置filebeat收集error日志
只收集正常日志往往是不完整的,錯(cuò)誤日志更需要收集起來
所有集群都按如下配置,其實(shí)就是增加了一個(gè)type和一個(gè)index
vim /etc/filebeat/filebeat.ymlfilebeat.inputs:- type: log enabled: true paths: - /var/log/nginx/www_access.log json.keys_under_root: true json.overwrite_keys: true tags: ["www"]- type: log enabled: true paths: - /var/log/nginx/bbs_access.log json.keys_under_root: true json.overwrite_keys: true tags: ["bbs"]- type: log enabled: true paths: - /var/log/nginx/blog_access.log json.keys_under_root: true json.overwrite_keys: true tags: ["blog"]- type: log enabled: true paths: - /var/log/nginx/error.log tags: ["error"]output.elasticsearch: hosts: ["192.168.81.210:9200"] indices: - index: "nginx-www-access-%{+yyyy.MM.dd}" when.contains:tags: "www" - index: "nginx-bbs-access-%{+yyyy.MM.dd}" when.contains:tags: "bbs" - index: "nginx-blog-access-%{+yyyy.MM.dd}" when.contains:tags: "blog" - index: "nginx-error-%{+yyyy.MM.dd}" when.contains:tags: "error"systemctl restart filebeat
2.查看es是否產(chǎn)生error索引
已經(jīng)生成
3.在kibana上關(guān)聯(lián)es索引
點(diǎn)擊Managerment---索引模式---創(chuàng)建索引
創(chuàng)建成功
4.在kibana上統(tǒng)計(jì)錯(cuò)誤日志
點(diǎn)擊Discovery---選擇索引即可查看,根據(jù)自己的需求進(jìn)行統(tǒng)計(jì)即可
以上就是filebeat同時(shí)收集錯(cuò)誤日志與普通日志并存詳解的詳細(xì)內(nèi)容,更多關(guān)于filebeat錯(cuò)誤普通日志并存的資料請(qǐng)關(guān)注其它相關(guān)文章!
標(biāo)簽:
Nginx
排行榜
