kql - Kusto 查询语言 - 提取两个字符之间的所有内容

标签 kql azure-sentinel

我正在努力从 Sentinel 的 extraextensions 列中提取电子邮件地址。我找到了一个在 calculator 中完美运行的正则表达式,提取冒号 (:) 到分号之后的所有内容,后跟分号 (;s)。但是,它在 Kusto 中不起作用,我怀疑是因为它使用了回溯?

下面是在计算器中运行的正则表达式:

(?<=:).*(?=;s)

这是来自其中一个日志的数据:

cat=EXFILTRATION;帐户=O365:[email protected] ;开始=1659975196000;结束=165997519600

使用计算器时,它返回以下内容:

[email protected]

但是,当尝试在 Kusto 中使用它时,它会返回原始数据。有谁能想出一种在 KQL 中实现这一目标的方法吗?

最佳答案

extracting everything after a colon (:) up to a semicolon followed by the latter s (;s).

您不必使用正则表达式。

例如,使用 parse operator :

print input = 'cat=EXFILTRATION;account=O365:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62070f030b0e4c0306061007111122160711164c0d10054c1709" rel="noreferrer noopener nofollow">[email protected]</a>;start=1659975196000;end=165997519600'
| parse input with * ":" email_address ";s" *
<表类=“s-表”> <标题> 输入 电子邮件地址 <正文> cat=EXFILTRATION;帐户=O365:[email protected] ;开始=1659975196000;结束=165997519600 [email protected]

关于kql - Kusto 查询语言 - 提取两个字符之间的所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73298123/

相关文章:

azure - 仅比较 kql 中日期时间的时间部分

azure - 如何在 KQL 上创建转化指标

Azure Sentinel RBAC - 最佳实践

microsoft-graph-api - 获取所有 TI 指标返回空列表

Azure Sentinel 心跳监视器

azure - Microsoft Sentinel - 如何删除自动化剧本模板

azure-data-explorer - Kusto - 每个系列的最后一行时间戳

azure - 在 Azure ADX Kusto 查询中将 UTC 时间转换为特定时区

azure-data-explorer - 如何从 Kusto 日期时间中删除秒和毫秒

Syslog 中的 Azure SIEM 数据格式