Kusto 数组中每个值的累计出现次数

J-R*_*J-R 2 kql azure-data-explorer

我希望使用 KQL 从存储在应用程序见解中的页面视图的查询字符串中获取查询参数使用情况的计数。我的查询目前看起来像:

pageViews
| project parsed=parseurl(url)
| project keys=bag_keys(parsed["Query Parameters"])
Run Code Online (Sandbox Code Playgroud)

结果看起来像

在此输入图像描述

每行看起来像

在此输入图像描述

我希望获取列表中包含的每个值的计数,以便url回答“页面在查询字符串中出现多少次”的问题。所以结果可能如下所示:

页 | 来自| ...


1000 | 1000 67 | 67 ...

提前致谢

Yon*_*i L 5

你可以尝试以下方法:

datatable(url:string)
[
    "https://a.b.c/d?p1=hello&p2=world",
    "https://a.b.c/d?p2=world&p3=foo&p4=bar"
]
| project parsed = parseurl(url)
| project keys = bag_keys(parsed["Query Parameters"])
| mv-expand key = ['keys'] to typeof(string)
| summarize count() by key
Run Code Online (Sandbox Code Playgroud)

返回:

| key | count_ |
|-----|--------|
| p1  | 1      |
| p2  | 2      |
| p3  | 1      |
| p4  | 1      |
Run Code Online (Sandbox Code Playgroud)