使用联合运算符

已完成

联合运算符采用两个或多个表,并返回所有表的行。 有必要了解结果是如何通过管道符号传递的,又是如何受到该字符影响的。

根据“查询”窗口中设置的时间范围:

  • 查询 1 将返回 SecurityEvent 的所有行和 SigninLogs 的所有行

  • 查询 2 将返回一行和一列,也就是 SecurityEvent 的所有行和 SigninLogs 的所有行的计数

  • 查询 3 将返回 SecurityEvent 的所有行和针对 SigninLogs 的一行。

分别运行每个查询以查看结果。

// Query 1

SecurityEvent 
| union SigninLogs  

// Query 2

SecurityEvent 
| union SigninLogs  
| summarize count() 
| project count_

// Query 3

SecurityEvent 
| union (SigninLogs | summarize count()| project count_)

联合运算符支持使用通配符来联合多个表。 以下 KQL 将为名称以 Security 开头的所有表中的行创建一个计数。

union Security* 
| summarize count() by Type