max

max 函式會傳回數值欄中的最大值。這項函式通常會與 match 搭配使用,以取得資料中每個群組的最大值。

語法 參數資料類型 傳回類型
max(numericExpression) NUMBER NUMBER

程式碼範例

  • 找出 target.ip 不為空白的所有事件。針對所有符合 principal.ip 的事件,將 principal.ip 的最大值儲存在名為 max_seconds 的變數中。metadata.event_timestamp.seconds

    target.ip != ""
    match:
      principal.ip
    outcome:
      $max_seconds = max(metadata.event_timestamp.seconds)