max
max 函式會傳回數值欄中的最大值。這項函式通常會與 match 搭配使用,以取得資料中每個群組的最大值。
| 語法 | 參數資料類型 | 傳回類型 |
|---|---|---|
max(numericExpression) |
NUMBER |
NUMBER |
程式碼範例
找出
target.ip不為空白的所有事件。針對所有符合principal.ip的事件,將principal.ip的最大值儲存在名為max_seconds的變數中。metadata.event_timestamp.secondstarget.ip != "" match: principal.ip outcome: $max_seconds = max(metadata.event_timestamp.seconds)