如何在Application Insights事务搜索中筛选GET /user/*并排除GET /user/*/pets
在Application Insights中筛选GET /user/且排除/user//pets的请求
这个需求完全可以实现,直接用Application Insights的Kusto查询语言就能精准过滤:
方法一:基础匹配+排除
requests | where operation_Name startswith "GET /user/" | where operation_Name !contains "/pets"
- 第一行指定查询请求数据表
requests - 第二行筛选所有以
GET /user/开头的请求 - 第三行排除掉路径中包含
/pets的请求
方法二:正则精准匹配
如果需要更严格匹配(比如只保留/user/xxx格式,不允许后续子路径),可以用正则表达式:
requests | where operation_Name matches regex @"GET /user/[^/]+$"
这个表达式会匹配GET /user/后接任意非斜杠字符直到结尾的请求,自动排除/user/xxx/pets这类带后续路径的请求。
你只需要在Transaction Search界面点击右上角的「转到分析」(或直接切换到查询模式),输入上述语句即可得到目标结果。
内容的提问来源于stack exchange,提问作者Pure.Krome
相关产品推荐
相关产品推荐

