logstash-grok - 与 URIPATH 匹配的 GROK 模式
问题描述
这是我的示例网址
http://localhost:8080/abc2/query/errorLogs
只是试图提取query/errorLogs
. 为此,我尝试了以下 GROK patten
(%{URIPROTO}://%{URIHOST}(?<path>/[^/]+/[^/]+/[^/]+))
下面的输出我得到
{
"URIPROTO": [
[
"http"
]
],
"URIHOST": [
[
"localhost:8080"
]
],
"IPORHOST": [
[
"localhost"
]
],
"HOSTNAME": [
[
"localhost"
]
],
"IP": [
[
null
]
],
"IPV6": [
[
null
]
],
"IPV4": [
[
null
]
],
"port": [
[
"8080"
]
],
"path": [
[
"/abc2/query/errorLogs"
]
]
}
但我期望路径应该是“/query/errorLogs”。
解决方案
试试这个 :
(%{URIPROTO}://%{URIHOST}(?<first_path>/[^/]+)%{GREEDYDATA:path})
结果:
port 8080
first_path /abc2
path /query/errorLogs
推荐阅读
- laravel - Laravel Eloquent with() 关系 - 按 2 个不同的嵌套关系排序
- oracle - Oracle SQL - 来自/来自带有日期的表的日期
- python - 如何在 python 中使用 tweepy 访问带有不记名令牌的推文?
- python - Lambda 中的库存流日志连接
- spring-boot - Spring boot 和 Apache Kafka 通过 Docker compose 抛出 LEADER_NOT_AVAILABLE of topic 和 Send failed 错误
- python - 如何一次从多个设备检索数据流/输入
- javascript - 使用地图功能渲染列表
- ruby-on-rails - 使用 sum & count 进行多组查询
- sql - 如何使用 Laravel 从 sql 表中获取缺失的日期
- android-studio - 无法在 Android Studio 中构建简单的数据绑定应用程序,当我尝试构建它时总是出现错误 java.lang.NullPointerException