当前位置:网站首页>filebeat、logstash配置安装
filebeat、logstash配置安装
2022-04-23 19:26:00 【hy_208】
1.下载安装包
https://www.elastic.co/cn/downloads/past-releases/filebeat-7-6-1
https://www.elastic.co/cn/downloads/past-releases/logstash-7-6-1
2.logstash配置文件
在logstash config目录下新建logstash.conf文件
logstash.conf配置如下:
input {
beats {
port => 5044
}
}
filter {
grok {
match => {
"message" => "%{TIMESTAMP_ISO8601:timestamp}\s*\[%{DATA:jetty}\]\s*%{LOGLEVEL:log_level}\s*%{NUMBER:number}\s*\TID:%{DATA:TID}\s*\---\s*\[%{DATA:thread}\]\s*(?m)(?<msg>.*|\s)"
}
}
mutate {
enable_metric => "false"
remove_field => ["message", "log", "tags", "input", "agent", "host", "ecs", "@version"]
}
date {
match => ["date","dd/MMM/yyyy:HH:mm:ss Z","yyyy-MM-dd HH:mm:ss"]
target => "date"
}
}
output {
elasticsearch {
hosts => ["12.0.0.1:9200"]
index => "web_log_%{+YYYY-MM}"
}
}
2022-04-21 08:48:20.277 [wkb-api-biz] INFO 3389 TID:760669fd04d54b0188f4ac533499b57f.116.16505021002761001 --- [XNIO-1 task-1] a.LoginUserHandlerMethodArgumentResolver
grok正则表达式对应自己的日志文件:
%{TIMESTAMP_ISO8601:timestamp}\s*\[%{DATA:jetty}\]\s*%{LOGLEVEL:log_level}\s*%{NUMBER:number}\s*\TID:%{DATA:TID}\s*\---\s*\[%{DATA:thread}\]\s*(?m)(?<msg>.*|\s)
3.进入logstash 按照目录
bin/logstash -f config/logstash.conf --config.reload.automatic &
3.filebeat配置文件
在filebeat目录下新建filebeat.yml、input-jetty.yml两个文件
filebeat.yml配置如下:
filebeat.config:
inputs:
enabled: true
path: input-jetty.yml
reload.enabled: true
reload.period: 10s
output.logstash:
enabled: true
hosts: ["127.0.0.1:5044"]
escape_html: true
index: 'wkb-jetty'
logging.level: info
logging.to_files: true
logging.files:
path: /var/log/filebeat
name: filebeat.log
rotateeverybytes: 104857600
keepfiles: 7
permissions: 0644
input-jetty.yml配置如下
- type: log
enabled: true
tags: ["jetty"]
paths:
- /data/log/jetty/*jetty-custom.log
multiline.pattern: '^\[[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
4. 启动filebeat
./filebeat -e -c filebeat.yml
版权声明
本文为[hy_208]所创,转载请带上原文链接,感谢
https://blog.csdn.net/hy_208/article/details/124314103
边栏推荐
- PostgreSQL
- openlayers 5.0 两种居中方式
- 什么是消息队列
- RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
- 山大网安靶场实验平台项目-个人记录(五)
- C学习完结
- Some ideas about time-consuming needs assessment
- Parsing headless jsonarray arrays
- 对普通bean进行Autowired字段注入
- How to select the third-party package of golang
猜你喜欢

ESP8266-入门第一篇

An algorithm problem was encountered during the interview_ Find the mirrored word pairs in the dictionary

深度学习——特征工程小总结

Grafana 分享带可变参数的链接

RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`

Is meituan, a profit-making company with zero foundation, hungry? Coupon CPS applet (with source code)

MySQL syntax collation (5) -- functions, stored procedures and triggers

5 minutes to achieve wechat cloud applet payment function (including source code)

Wechat applet part of the mobile phone Preview PDF did not respond

The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
随机推荐
Speculation on the way to realize the smooth drag preview of video editing software
No, some people can't do the National Day avatar applet (you can open the traffic master and earn pocket money)
Core concepts of rest
Easy mock local deployment (you need to experience three times in a crowded time. Li Zao will do the same as me. Love is like a festival mock)
Matlab 2019 installation of deep learning toolbox model for googlenet network
点云数据集常用处理
MFCC: Mel频率倒谱系数计算感知频率和实际频率转换
数据分析学习目录
音频编辑生成软件
C1000k TCP connection upper limit test
A brief explanation of golang's keyword "competence"
How to uninstall easyton
Kubernetes入门到精通-KtConnect(全称Kubernetes Toolkit Connect)是一款基于Kubernetes环境用于提高本地测试联调效率的小工具。
Kubernetes入门到精通-裸机LoadBalence 80 443 端口暴露注意事项
White screen processing method of fulter startup page
Build intelligent garbage classification applet based on Zero
Network protocol: SCTP flow control transmission protocol
arcMap 发布切片服务
Speex维纳滤波与超几何分布的改写
Modify the font size of hint in editext