当前位置:网站首页>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
边栏推荐
猜你喜欢
Reflection on the performance of some OpenGL operations in the past
ArcMap publishing slicing service
Application of DCT transform
The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
Intuitive understanding of the essence of two-dimensional rotation
深度分析数据恢复原理——那些数据可以恢复那些不可以数据恢复软件
An idea of rendering pipeline based on FBO
Openharmony open source developer growth plan, looking for new open source forces that change the world!
指针数组与数组指针的区分
OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
随机推荐
MySQL syntax collation (3)
Some ideas about time-consuming needs assessment
@MapperScan与@Mapper
点云数据集常用处理
Codeforces Round #784 (Div. 4)
Customize the non slidable viewpage and how to use it
Summary of several relationships of UML class diagram
Go modules daily use
Prefer composition to inheritance
js上传文件时控制文件类型和大小
Use of fluent custom fonts and pictures
JVM的类加载过程
js获取本机ip地址
The platinum library cannot search the debug process records of some projection devices
Wechat applet part of the mobile phone Preview PDF did not respond
Core concepts of rest
A brief explanation of golang's keyword "competence"
NiO related Basics
深度学习——特征工程小总结
UML类图几种关系的总结