Azure Log Analytics查询属性是否存在

时间:2018-09-20 15:22:39

标签: azure azure-application-insights azure-log-analytics

我正在尝试检查我的customDimensions对象是否具有属性,然后仅计算将属性设置为某些值的查询。它正在计算SupportedLanguage对象中没有customDimensions属性的查询。

这是我当前的查询:

customEvents
| where timestamp > ago(7d)
| summarize COUNT=count(customDimensions.SupportedLanguage) by lang=tostring(customDimensions.SupportedLanguage)
| render piechart

我尝试执行以下操作,但没有成功:

customEvents
| where timestamp > ago(7d)
| where customDimensions.SupportedLanguage
| summarize COUNT=count(customDimensions.SupportedLanguage) by lang=tostring(customDimensions.SupportedLanguage)
| render piechart 

1 个答案:

答案 0 :(得分:3)

您可以利用isnotempty()函数来实现此目的:

customEvents
| where timestamp > ago(7d)
| where isnotempty(customDimensions.SupportedLanguage)