如果行在 Kusto 中不可用,则将该值设置为 0

Ale*_*lla 4 kql azure-data-explorer kusto-explorer

我的查询有 count 函数,它返回按天汇总的行数。现在,当该表中没有行时,我没有得到任何结果,而是需要包含所有天数的行并且计数为零。我尝试过coalesc但没有成功。任何帮助深表感谢!

谢谢!

这是我的查询:

exceptions
 | where name == 'my_scheduler' and timestamp > ago(30d)
 | extend day = split(tostring(timestamp + 19800s), 'T')[0]
 | summarize schedulerFailed = coalesce(count(),tolong("0")) by tostring(day)
Run Code Online (Sandbox Code Playgroud)

Sla*_*k N 6

而不是summarize您需要使用make-serieswhich 来填补默认值的空白。

exceptions
| where name == 'my_scheduler' and timestamp > ago(30d)
| extend day = split(tostring(timestamp + 19800s), 'T')[0]
| make-series count() on tolong(x) step 1
Run Code Online (Sandbox Code Playgroud)

您可能需要添加fromtoto ,make-series以便它也可以填补 30 天期间开始和结束时的空白。