azure-log-analytics - 从查询中获取输出并在后续 KQL 查询中使用
问题描述
我正在使用 Azure Log Analytics 来查看某些感兴趣的事件。
我想从满足特定标准的数据中获取时间戳,然后在进一步的查询中重用这些时间戳,即查看这些时间周围还发生了什么。
以下查询返回所需的结果,但我不知道如何使用interestingTimes
var 然后在每个先前返回的时间戳的 X 分钟内执行进一步的搜索并显示数据。
let interestingTimes =
Event
| where TimeGenerated between (datetime(2021-04-01T11:57:22) .. datetime('2021-04-01T15:00:00'))
| where EventID == 1
| parse EventData with * '<Data Name="Image">' ImageName "<" *
| where ImageName contains "MicrosoftEdge.exe"
| project TimeGenerated
;
任何指针将不胜感激。
解决方案
interestingTimes
只能在您声明它的查询中使用。您不能在另一个查询中使用它,除非您也在那里定义它。
顺便说一句,您可以通过添加一个过滤器来提高查询效率,该过滤器将利用列的内置索引EventData
,以便parse
操作符在更少的记录上运行:
let interestingTimes =
Event
| where TimeGenerated between (datetime(2021-04-01T11:57:22) .. datetime('2021-04-01T15:00:00'))
| where EventID == 1
| where EventData has "MicrosoftEdge.exe" // <-- OPTIMIZATION that will filter out most records
| parse EventData with * '<Data Name="Image">' ImageName "<" *
| where ImageName contains "MicrosoftEdge.exe"
| project TimeGenerated
;
推荐阅读
- android - Android 资源链接失败 AAPT:未知选项“--no-proguard-location-reference”
- html - Jumbotron 图像在桌面上运行良好,在移动设备上图像被炸毁,我无法调整大小
- r - R:将 data.frames 拆分为给定数量的小 data.frames
- c# - Postfix .NET Docker:如何使用 C# 通过 Postfix 发送电子邮件
- azure-logic-apps - Azure 文件系统连接器
- python - TF2.2:从 tensorflow_hub 加载保存的模型失败,出现 `AttributeError: '_UserObject' object has no attribute 'summary'`
- java - 以最快的方式在 csv 中写入 100,000 行
- python - 在字符串中查找子字符串并返回其索引?
- python - 熊猫:过滤大日期框并在两个不同的目录中写入 to_csv?
- html - Bootstrap - 使用 box-shadow 和溢出的组合:隐藏