群組
支援的國家/地區:
group(field1, field2, field3, ...)
說明
將類似型別的欄位歸入預留位置變數。
在 UDM 搜尋中,同組欄位可用於搜尋多個類似類型的欄位。群組功能與分組欄位類似,但可讓您選取要分組的欄位,以觸發偵測。您可以使用群組函式,收集不同名詞類型中特定實體 (例如主機名稱、IP 位址或使用者 ID) 的相關資訊。
參數類型:
Event type傳回類型:
Grouped event fields
程式碼範例
範例:彙整及計算 IP 位址
將所有 IP 位址歸類在一起,並依掃描時間範圍內最常見的 IP 位址,提供遞減計數。
$ip = group(principal.ip, about.ip, target.ip)
$ip != ""
match:
$ip
outcome:
$count = count_distinct(metadata.id)
order:
$count desc
範例:計算每個 IP 位址的不同事件數
在下列範例中,group() 函式會收集所有觸發偵測的事件中,principal.ip、target.ip 和 src.ip 欄位內的所有 IP 位址。然後將 IP 位址新增至預留位置變數 $ip。接著,規則會比對 IP 位址,並傳回每個不重複 IP 位址的不同事件計數。
$ip = group(detection.collection_elements.references.event.principal.ip, detection.collection_elements.references.event.target.ip, detection.collection_elements.references.event.src.ip)
$ip != ""
match:
$ip
outcome:
$count = count_distinct(detection.id)
order:
$count desc
// Detection1: principal.ip = 1.1.1.1
// Detection2: src.ip = 1.1.1.1, target.ip = 2.2.2.2
// Detection3: target.ip = 1.1.1.1
// Detection4: principal.ip = 2.2.2.2
結果:
$ip |
$count |
|---|---|
| 1.1.1.1 | 3 |
| 2.2.2.2 | 2 |