带有 WHERE 子句的 Azure Log Analytics 查询不产生任何结果

Azure Log Analytics Query with WHERE clause produces no results

我正在使用 Azure Log Analytics 查询 Azure Application Insights 中源自 AppCenter 诊断的日志条目。 在某些日志条目中,我使用自定义 属性s。 现在我正在尝试编写一个查询以仅显示具有给定值的某些属性的值。

我的原始查询看起来像这样并产生了预期的结果:

customEvents
| where (timestamp >= datetime(2019-02-20T09:04:00.000Z) and timestamp <= datetime(2019-02-21T09:04:00.000Z)) 
| top 101 by timestamp desc
| project timestamp, name, customDimensions.Properties
| where name == "Navigated to details view"

将鼠标悬停在 "productId" 属性 上会显示一个加号,允许添加过滤条件:

选择此选项可扩展我的查询:

customEvents
| where (timestamp >= datetime(2019-02-20T09:04:00.000Z) and timestamp <= datetime(2019-02-21T09:04:00.000Z)) 
| top 101 by timestamp desc
| project timestamp, name, customDimensions.Properties
| where name == "Navigated to details view"
| where customDimensions_Properties.productId == 4711 

到目前为止,还不错。如果我现在尝试 运行 这个查询,我会收到消息 "NO RESULTS FOUND":

编辑: 我还尝试将底部的 where 子句添加到第一个 where 子句

customEvents
| where (timestamp >= datetime(2019-02-20T09:04:00.000Z) and timestamp <= datetime(2019-02-21T09:04:00.000Z)) 
and name == "Navigated to details view" 
and customDimensions.Properties.productId == 4711
| top 101 by timestamp desc
| project timestamp, name, customDimensions

很遗憾也没有结果。

编辑 2: 我还尝试了此查询以查看是否可以在我的查询中投影 productId 属性 而无需将其包含在 where 子句中:

customEvents
| where (timestamp >= datetime(2019-02-20T09:04:00.000Z) and timestamp <= datetime(2019-02-21T09:04:00.000Z)) 
and name == "Navigated to details view" 
| top 101 by timestamp desc
| project timestamp, name, customDimensions, customDimensions.Properties.productId

但是这一栏是空的:

有什么我遗漏的吗?工具是否有问题并产生错误的查询?

感谢您的帮助!

您将不得不使用各种运算符(例如 mvexpand 和 extend)来完成您的要求。请在下面找到示例查询。请注意,下面的查询只是一个示例查询,您可能需要稍微调整一下才能使其按预期工作并获得预期的输出(比如您是否期望在特定时间戳处输出 customEvent 的所有列,该时间戳具有特定的productId等)

customEvents
| where (timestamp >= datetime(2019-02-20T09:04:00.000Z) and timestamp <= datetime(2019-02-21T09:04:00.000Z)) 
| top 101 by timestamp desc
| project timestamp, name, customDimensions_Properties
| where name == "Navigated to details view"
| extend CDP_toString=parsejson(tostring(customDimensions_Properties))
| mvexpand CDP_toString
| project CDP_toString
| where CDP_toString.['productId'] == "4711";

希望对您有所帮助!!干杯!! :)