tencent cloud

Cloud Log Service

Log Filtering

下载
聚焦模式
字号
最后更新时间: 2026-05-13 19:36:27

Scenario description

Xiao Wang collected the tool's logs into CLS. Now, it is necessary to filter out logs with the operation method of PUT and POST from the cmdb logs.

Raw Log

[
{
"path": "/eks/pod/running",
"clientIP": "1.139.21.123",
"method": "POST"
},
{
"path": "/cmdb/login",
"clientIP": "1.139.21.123",
"method": "PUT"
},
{
"path": "/cmdb/start",
"clientIP": "1.139.21.123",
"method": "GET"
}
]

Processing statement

//path contains 'cmdb' characters, keep the log, filter out the rest
log_keep(regex_match(v("path"),regex="cmdb",full=False))
//method contains POST or PUT characters, keep the log
log_keep(regex_match(v("method"),regex="POST|PUT",full=False))

Processing result

{
"clientIP":"1.139.21.123",
"method":"PUT",
"path":"/cmdb/login"
}


帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈