admin管理员组文章数量:1568432
Windows版本
第一步
下载安装包。
下载地址:https://www.elastic.co/cn/downloads/beats/filebeat
第二步
解压安装包。并配置【filebeat.yml】文件。
注:具体支持的输出方式可以参考官网:https://www.elastic.co/guide/en/beats/filebeat/current/configuring-output.html
以日期开头合并的多行:
filebeat.inputs:
- type: log
enabled: true
paths:
- G:/log/*.log
multiline:
#正则,以日期开头的合并多行
pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
negate: true
match: after
max_lines: 1000
timeout: 3s
output.elasticsearch:
hosts: ["127.0.0.1:9200"]
index: "actionlog-%{+yyyy.MM}"
setup.template.name: "actionlog"
setup.template.pattern: "actionlog-*"
setup.ilm.enabled: false
以<数字>开头合并多行:
filebeat.inputs:
- type: log
#是否开启配置,此处需要设置true
enabled: true
#监控目录
paths:
- G:/log/*.log
multiline:
pattern: '^<[0-9]+'
negate: true
match: after
timeout: 10s
#输出ES
output.elasticsearch:
hosts: ["127.0.0.1:9200"]
index: "actionlog-%{+yyyy.MM}"
setup.template.name: "actionlog"
setup.template.pattern: "actionlog-*"
setup.ilm.enabled: false
优化文件只读取一次,1分钟不更新就关闭监控的方案:
filebeat.inputs:
- type: log
#是否开启配置,此处需要设置true
enabled: true
# 检查文件更新的频率
# 默认是 10s
scan_frequency: 10s
#只读取一次文件,读取完成之后,关闭收割机
close_eof: true
# 如果一个文件在某个时间段内没有发生过更新则关闭监控的文件handle。默认1h,change只会在下一次scan才会被发现
close_older: 1m
#即当文件名称有变化时,包括改名和删除,会自动关闭一个文件
force_close_files: true
#监控目录
paths:
- G:/log/*.log
multiline:
pattern: '^<[0-9]+'
negate: true
match: after
timeout: 10s
#输出ES
output.elasticsearch:
hosts: ["127.0.0.1:9200"]
index: "actionlog-%{+yyyy.MM}"
setup.template.name: "actionlog"
setup.template.pattern: "actionlog-*"
setup.ilm.enabled: false
以<数字>开头合并多行并输出的KafKa:
filebeat.inputs:
- type: log
#是否开启配置,此处需要设置true
enabled: true
# 检查文件更新的频率
# 默认是 10s
scan_frequency: 10s
#只读取一次文件,读取完成之后,关闭收割机
close_eof: true
# 如果一个文件在某个时间段内没有发生过更新则关闭监控的文件handle。默认1h,change只会在下一次scan才会被发现
close_older: 1m
#即当文件名称有变化时,包括改名和删除,会自动关闭一个文件
force_close_files: true
#监控目录
paths:
- /monitor/log/*.log
multiline:
pattern: '^<[0-9]+'
negate: true
match: after
timeout: 10s
#输出KafKa
output.kafka:
hosts: ["localhost:9092"]
topic: hillstonelog
keep_alive: 10s
第三步
启动fileBeat。需要用cmd窗口启动。
.\filebeat -e -c filebeat.yml
Linux版本
第一步
下载安装包。
下载地址:https://www.elastic.co/cn/downloads/beats/filebeat
第二步
将压缩包上传到指定目录并解压
tar -zxvf filebeat-7.14.1-linux-x86_64.tar.gz
第三步
配置【filebeat.yml】文件。
注:具体支持的输出方式可以参考官网:https://www.elastic.co/guide/en/beats/filebeat/current/configuring-output.html
第四步
启动fileBeat。
./filebeat -e -c filebeat.yml
#后台启动
nohup ./filebeat -e -c filebeat.yml > /dev/null 2>&1 &
版权声明:本文标题:FileBeat安装(包含Windows和Linux) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1725617306a1033119.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论