KQL 查询 - 在 where 子句中相对选择今天的数据

问题描述

我需要一种方法来在 Azure Monitor 中选择“自午夜以来”的数据集 - 例如相对于当天。

使用 ago(1d) 显然不起作用:)

StorageBlobLogs
    | where TimeGenerated > ago(1d) and StatusText contains "success"

干杯

解决方法

您可以尝试使用 startofday()

例如:... | where TimeGenerated > startofday(now())