当前位置:网站首页>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
边栏推荐
- Keysight has chosen what equipment to buy for you
- 山大网安靶场实验平台项目—个人记录(四)
- Lottery applet, mother no longer have to worry about who does the dishes (assign tasks), so easy
- C学习完结
- Gossip: on greed
- MySQL syntax collation (4)
- Golang timer
- Openlayers 5.0 thermal diagram
- [transfer] summary of new features of js-es6 (one picture)
- HTTP cache - HTTP authoritative guide Chapter VII
猜你喜欢
Kubernetes入门到精通-裸机LoadBalence 80 443 端口暴露注意事项
2021-2022-2 ACM集训队每周程序设计竞赛(8)题解
Zero base to build profit taking away CPS platform official account
White screen processing method of fulter startup page
Decompile and get the source code of any wechat applet - just read this (latest)
精简CUDA教程——CUDA Driver API
Openharmony open source developer growth plan, looking for new open source forces that change the world!
The platinum library cannot search the debug process records of some projection devices
MySQL syntax collation (2)
MFCC: Mel频率倒谱系数计算感知频率和实际频率转换
随机推荐
The flyer realizes page Jump through routing routes
Gossip: on greed
Go three ways to copy files
No, some people can't do the National Day avatar applet (you can open the traffic master and earn pocket money)
Build intelligent garbage classification applet based on Zero
Hot reload debugging
深度学习环境搭建步骤—gpu
JS controls the file type and size when uploading files
Garbage collector and memory allocation strategy
MFCC: Mel频率倒谱系数计算感知频率和实际频率转换
Use of fluent custom fonts and pictures
An algorithm problem was encountered during the interview_ Find the mirrored word pairs in the dictionary
SSDB foundation 2
Redis core technology and practice 1 - start with building a simple key value database simplekv
SQL Server database in clause and exists clause conversion
JS to get the local IP address
点云数据集常用处理
openlayers draw矩形
js上传文件时控制文件类型和大小
openlayers 5.0 加载arcgis server 切片服务