使用選取和取消選取關鍵字來控制資料欄
在「搜尋」和「資訊主頁」中,您可以使用 select
和 unselect
關鍵字,自訂「搜尋」的「結果」分頁中「事件」表格顯示的資料欄,以及資訊主頁小工具中的表格。
預設資料欄為「時間戳記」和「事件」,且一律會顯示。
select
和 unselect
關鍵字分別會在「事件」欄旁邊新增和移除資料欄。
select
:將指定資料欄新增至「事件」表格unselect
:從「事件」表格中移除指定資料欄
這些關鍵字只會變更事件的顯示方式。
使用範例
本節的範例說明在搜尋查詢中使用 select
和 unselect
關鍵字的常見語法。
舉例來說,下列查詢會搜尋與 alex-laptop
相關聯的事件,並將 security_result.about.email
新增為「事件」表格的資料欄:
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
匯總和事件範例
「select
」和「unselect
」部分互斥,可讓使用者納入或排除結果變數、比對變數、事件欄位或實體欄位。
所有 UDM 搜尋都是單一事件搜尋或匯總搜尋 (也稱為事件統計資料)。匯總搜尋會指定 match
關鍵字,或在輸出內容中使用匯總函式 (例如 sum
或 count
)。
單一事件搜尋
這個範例會新增 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 專業人員尋求答案。