Reputation: 150228
My query must extract a query string parameter from a URL in a data column. Unfortunately, Kusto appears bugged in that the base URL is considered part of the first parameter's name as indicated in this example:
datatable (MyUrl:string)
[
"http://foo/?p1=bar&p2=baz",
"http://foo/?p1=bar&p2=quuz",
"http://roo/?p1=biz&p2=fizz"
]
| project parse_urlquery(MyUrl)["Query Parameters"]["http://foo/?p1"], parse_urlquery(MyUrl)["Query Parameters"]["p1"], parse_urlquery(MyUrl)["Query Parameters"]["p2"]
How can I reliably extract p1 (Note, it's not necessarily first in the actual URL).
Upvotes: 0
Views: 1297
Reputation: 25965
did you perhaps intend to use parse_url()
and not parse_urlquery()
?
datatable (MyUrl:string)
[
"http://foo/?p1=bar&p2=baz",
"http://foo/?p1=bar&p2=quuz",
"http://roo/?p1=biz&p2=fizz"
]
| project parse_url(MyUrl)["Query Parameters"]
Query Parameters
----------------
{
"p1": "bar",
"p2": "baz"
}
----------------
{
"p1": "bar",
"p2": "quuz"
}
----------------
{
"p1": "biz",
"p2": "fizz"
}
Upvotes: 2