elasticsearch - HTTP URL 的 GROK 模式
问题描述
试图解析下面的字符串
http://localhost:8080/client/session/login abc.xyz@yahoo.com backendorg
具有以下 GROK 模式
%{URIPATHPARAM:url}%{SPACE}%{EMAILADDRESS:email}%{SPACE}%{USERNAME:org}
没有得到完整的网址。
{
"org": "backendorg",
"url": "//localhost:8080/client/session/login",
"email": "abc.xyz@zinier.com"
}```
Anyone could suggest how to get complete URL.
解决方案
GROK 模式:
%{URI:url}%{SPACE}(?<email>[a-zA-Z0-9_.+=:-]+@[0-9A-Za-z][0-9A-Za-z-]{0,62}(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*)%{SPACE}%{USERNAME:org}
输出:
{
"url": [
[
"http://localhost:8080/client/session/login"
]
],
"URIPROTO": [
[
"http"
]
],
"USER": [
[
null
]
],
"USERNAME": [
[
null
]
],
"URIHOST": [
[
"localhost:8080"
]
],
"IPORHOST": [
[
"localhost"
]
],
"HOSTNAME": [
[
"localhost"
]
],
"IP": [
[
null
]
],
"IPV6": [
[
null
]
],
"IPV4": [
[
null
]
],
"port": [
[
"8080"
]
],
"URIPATHPARAM": [
[
"/client/session/login"
]
],
"URIPATH": [
[
"/client/session/login"
]
],
"URIPARAM": [
[
null
]
],
"SPACE": [
[
" ",
" "
]
],
"email": [
[
"abc.xyz@yahoo.com"
]
],
"org": [
[
"backendorg"
]
]
}
推荐阅读
- c# - 如何检查对象的 FIELD 是否存在于给定对象的列表中?
- javascript - React - conditional/message
- node.js - nodejs消耗的内存随着项目大小的增加而不断增加是否正常
- python - 制作一个接受用户输入的计算器,直到用户输入 0 但无法正常工作
- javascript - 永远不会调用带有 Jest 的模拟模块函数
- r - mlr3 的 task$feature_names 在 R 中重新排序变量?
- c++ - 如何使用两个类型定义向量上的指针进行访问
- python - pandas 将字符串转换为日期类型。1678 年 1 月 1 日发生了什么?
- javascript - 在 Google Apps 脚本中处理日期时遇到问题
- c - 如果不能重新定义变量,如何在 C 中使用复合赋值运算符?