使用选择和取消选择关键字来控制列

支持的平台:

在“搜索”和信息中心内,您可以使用 selectunselect 关键字自定义“搜索”的结果标签页上事件表格中显示的列,以及信息中心 widget 中的表格。

默认列为时间戳事件,并且始终会显示。selectunselect 关键字分别用于在事件列旁边添加和移除列。

  • select:将指定列添加到 Events
  • unselect:从 Events 表中移除指定列

这些关键字仅会改变事件的显示方式。

用法示例

本部分中的示例演示了在搜索查询中使用 selectunselect 关键字的常见语法。

例如,以下查询会搜索与 alex-laptop 相关的事件,并将 security_result.about.email 作为列添加到 Events 表中: none principal.hostname = "alex-laptop" limit: 10 select: security_result.about.email

多列示例

活动表将 target.asset.hostname 作为第一列(在时间戳活动列之后)。

例如,您可以添加多个列:

principal.hostname = "alex-laptop"
limit: 10
select: network.sent_bytes, security_result.about.email

结果变量示例

您可以将变量与 select 关键字搭配使用。以下示例将 $seconds 声明为等于 metadata.event_timestamp.seconds 统一数据模型 (UDM) 字段值的结果变量。然后,您可以使用 select 关键字指定该值,并且 Seconds 值会显示为其中一列。

principal.hostname = "alex-laptop"
outcome:
  $seconds = metadata.event_timestamp.seconds
limit: 10
select: $seconds, security_result.about.email

汇总和事件示例

selectunselect 部分是互斥的,可让用户包含或排除结果变量、匹配变量、事件字段或实体字段。

所有 UDM 搜索都是单事件搜索或汇总搜索(也称为事件统计信息)。汇总搜索会指定 match 关键字,或在输出中使用汇总函数(例如 sumcount)。

此示例添加了 metadata.event_timestamp 的列:

events:
  principal.hostname = "alex-laptop"
  metadata.event_type = "NETWORK_CONNECTION"
select:
  metadata.event_timestamp

在此示例中,表示 $hostname$count_id 的列已添加到 Events 表中:

events:
    $e.metadata.event_type != "RESOURCE_CREATION"
    $e.principal.hostname = $hostname
    $id = $e.network.session_id
match:
    $hostname over 1h
outcome:
    $count_hostname = count($hostname)
    $count_id = count($id)
unselect:
    $count_hostname

需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。