我有一个基本的 Azure 警报,它查看 VM 的 Windows 日志,并确定是否应在检测到特定事件 ID 时触发警报
Event | where EventID == "500" | summarize arg_max(TimeGenerated, *) by ParameterXml | project TimeGenerated, Computer, EventID, RenderedDescription | order by TimeGenerated
条件是事件是否在5分钟内检测到一次或多次。我希望在那里有一些警报逻辑,如果附加警报事件“650”not 被触发,它只会触发。
我曾尝试使用连接将附加事件 ID 附加到查询中,但不确定如何解析逻辑以表示 not fired
https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-log-query(示例 4)
总结
如果检测到事件 ID 500 则触发警报并且未检测到事件 ID 650
可能的解决方案:
Event
| where EventID in (500, 650)
| summarize
arg_max(iff(EventID == 500, TimeGenerated, datetime(null)), *),
Cond= countif(EventID == 650) == 0
by Computer
| where Cond
| project TimeGenerated, Computer, EventID, RenderedDescription
| order by TimeGenerated
总结行过滤ID为500的最新事件,统计ID为650的事件。
join leftanti 的可能解决方案:
Event
| where EventID in (500, 650)
| summarize arg_max(TimeGenerated, *) by EventID, Computer
| as T
| where EventID == 500
| join kind=leftanti (T | where EventID == 650) on Computer