filebeat过滤及模块配置
  EeGZtZT5Jsfk 2023年11月02日 29 0

filebeat过滤用法及模块配置

# cat filebeat.yml
filebeat.inputs:
- input_type: log
paths:
- /var/log/pods/*/*/*.log
# 以#开头的行不收集
exclude_lines: ['^#']
fields:
log_topic: "${TOPIC_ID}"
tail_files: true
clean_inactive: 48h
ignore_older: 24h
close_inactive: 1m

# 启动配置模块,该模块作用能将nginx\tomcat等日志转换为json模式,而无需再用logstash自已过滤匹配。
filebeat.config.modules:
# ${path.config}路径在/usr/share/filebeat/
# /usr/share/filebeat/modules.d/*.yml
path: ${path.config}/modules.d/*.yml
reload.enabled: true

########### 查看当前有哪些模块可以启用
./filebeat modules list

# 启动system/nginx/mysql模块,当启动模块后,会在/usr/share/filebeat/modules.d/目录下生成nginx.yml|system.yml|mysql.yml
./filebeat modules enable system nginx mysql

########### 在以下的模块配置中modules.d,更改模块设置以匹配您的环境。
# 在filebeat.yml配置filebeat.config.modules启动模块使用后,还需要在以下文件修改配置路径
官网参考: https://www.elastic.co/guide/en/beats/filebeat/7.9/filebeat-installation-configuration.html#setup-assets
cat /usr/share/filebeat/modules.d/nginx.yml
- module: nginx
access:
enabled: true
# 日志位置是根据操作系统设置的。如果您的日志不在默认位置,请设置paths变量:
var.paths: ["/var/log/nginx/access.log*"]

error:
enabled: true
var.paths: ["/var/log/nginx/access.log*"]

# 点击Visualize—搜索要查看的图形,我们搜索nginx, 模块提供了丰富的图形
# 模块方面可参考https://blog.csdn.net/weixin_44953658/article/details/118358918


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  ehrZuhofWJiC   2024年05月17日   47   0   0 mysql
EeGZtZT5Jsfk