I am trying to summarize API requests by url using Application Insights:
requests
| summarize hits = count() by url
| order by hits desc
some of the URLs have path parameters which I would like to ignore in the summary, so if the following urls are called:
https://foo.bar/api/v1/items/abc123/latest
https://foo.bar/api/v1/items/xyz789/latest
I would like them to be summarized together as
url | hits |
---|---|
https://foo.bar/api/v1/items/*/latest| 2 |
How should I modify my Kusto query?
You can do this with 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