There are some functions that might be helpful.
First of all, you can get the different url parts using parse_url() method. For example, given the url https://localhost:80/api/external-reports/blob/39/test 01b/false :
requests
| project parse_url(url)
output:
{"Scheme":"https","Host":"localhost","Port":"80","Path":"/api/external-reports/blob/39/test 01b/false","Username":"","Password":"","Query Parameters":{},"Fragment":""}
- You can split the result even further using the split() method:
requests
| project split(parse_url(url).Path, "/")
output:
["","api","external-reports","blob","39","test 01b","false"]
- To get the part you want you can use the index:
request
| project mycolumn = split(parse_url(test).Path, "/")[5]
output:
test 01b
- When an index is used that is greater than the number of parts an empty result is returned. You can replace it with a value of your own using the coalesce function:
requests
| project mycolumn = coalesce(split(parse_url(test).Path, "/")[5], "unknown")
it shows unknown when the index is out of range or the part is empty.
CLICK HERE to find out more related problems solutions.