首页 > 解决方案 > 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 

标签: azureazure-application-insightsazure-log-analytics

解决方案


为此,您可以利用isnotempty()函数:

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

推荐阅读