Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持日志解析,解析出来的字段可以并转换为数组 #674

Open
zjf88865 opened this issue Apr 18, 2024 · 0 comments
Open

支持日志解析,解析出来的字段可以并转换为数组 #674

zjf88865 opened this issue Apr 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@zjf88865
Copy link

Describe the feature

举例
日志内容为:
01-Dec-2021 03:13:58.298 INFO shenzhen [main] Starting service [Catalina] time_zone:G8 country:China
{
"time": "01-Dec-2021 03:13:58.298",
"fields": {
"logconfig": "tomcat",
"namespace": "test1",
"nodename": "kind-control-plane",
"podname": "tomcat-85c84988d8-frs4n",
"containername": "tomcat",
"desc" :"这里是无用的信息,哈哈哈啊哈哈哈哈哈哈"
},
"level": "INFO",
"server_area": "shenzhen"
"message": "[main] Starting service [Catalina] time_zone:G8 country:China"
"keys":["time_zone","country",${server_area},${fields.namespace}],
"values":["G8","China","shenzhen","test1"]
}
keys和values可以随意命名,keys数组内容出现和下标和values出现的小标对应,例如:time_zone和G8,还要支持从现有输出格式里找到内容进行二次解析,上面例子就是我从message里解析出来的,${}可以从当前格式里取数据,例如${fields.namespace} 取到容器命名空间,${server_area}取到服务器部署区域,支持map取值,数组取值,多层级取值(a.b.c[0].d),解析如果发生错误,不能影响keys和values对应长度,例如["time_zone","country",${server_area},${fields.namespace}],我命名空间拿不到异常了,应该为null,而不是只有3个,如果可以最好解析完成后再支持后续解析去掉无用信息,例如我要去掉fields.desc
{
"time": "01-Dec-2021 03:13:58.298",
"fields": {
"logconfig": "tomcat",
"namespace": "test1",
"nodename": "kind-control-plane",
"podname": "tomcat-85c84988d8-frs4n",
"containername": "tomcat"
#这行数据被去掉了
},
"level": "INFO",
"server_area": "shenzhen"
"message": "[main] Starting service [Catalina] time_zone:G8 country:China"
"keys":["time_zone","country",${server_area},${fields.namespace}],
"values":["G8","China","shenzhen","test1"]
}

@zjf88865 zjf88865 added the enhancement New feature or request label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant