我正在尝试使用Application Insights:通过url总结API请求
requests
| summarize hits = count() by url
| order by hits desc
有些URL有路径参数,我想在摘要中忽略这些参数,所以如果调用以下URL:
https://foo.bar/api/v1/items/abc123/latest
https://foo.bar/api/v1/items/xyz789/latest
我希望将它们汇总为
url | 点击次数 |
---|---|
https://foo.bar/api/v1/items/*/最新|2 |
您可以使用regex_replace:执行此操作
requests
| extend newUrl = replace_regex(url, @"items/[a-zA-Z0-9]*/latest", @"items/*/latest")
| summarize hits = count() by newUrl
| order by hits desc