我是靠谱客的博主 曾经可乐,最近开发中收集的这篇文章主要介绍filebeat同时收集错误日志与普通日志并存(六)filebeat收集错误日志并与普通日志并存,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
filebeat收集错误日志并与普通日志并存
只收集正常日志往往是不完整的,错误日志更需要收集起来
1.配置filebeat收集error日志
所有集群都按如下配置,其实就是增加了一个type和一个index
vim /etc/filebeat/filebeat.yml
filebeat.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是否产生error索引
已经生成
3.在kibana上关联es索引
点击Managerment—索引模式—创建索引
创建成功
4.在kibana上统计错误日志
点击Discovery—选择索引即可查看,根据自己的需求进行统计即可
最后
以上就是曾经可乐为你收集整理的filebeat同时收集错误日志与普通日志并存(六)filebeat收集错误日志并与普通日志并存的全部内容,希望文章能够帮你解决filebeat同时收集错误日志与普通日志并存(六)filebeat收集错误日志并与普通日志并存所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复