window.stddev
以下でサポートされています。
window.stddev(numeric_values)
説明
一致ウィンドウ内の入力値の標準偏差を返します。
パラメータのデータ型
INT|FLOAT
戻り値の型
FLOAT
コードサンプル
例 1
この例では、一致ウィンドウ内の整数の標準偏差を返します。
// This rule creates a detection when the file size stddev in 5 minutes for a user is over a threshold.
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$p1 = window.stddev($e.file.size) // yields 4.0 if the event file size values in the match window are [10, 14, 18].
condition:
$e and #p1 > 2
例 2
この例では、一致ウィンドウ内の浮動小数点数の標準偏差を返します。
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$p1 = window.stddev($e.file.size) // yields 4.488686 if the event file size values in the match window are [10.00, 14.80, 18.97].
condition:
$e and #p1 > 2
例 3
この例では、一致ウィンドウ内の負の数値を含む標準偏差を返します。
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$p1 = window.stddev($e.file.size) // yields 48.644972 if the event file size values in the match window are [-1, -56, -98].
condition:
$e and #p1 > 2
例 4
この例では、一致ウィンドウ内のすべての値が同じ場合に、ゼロの標準偏差を返します。
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$p1 = window.stddev($e.file.size) // yields 0.000000 if the event file size values in the match window are [1, 1, 1].
condition:
$e and #p1 > 2
例 5
この例では、正と負の数値を含む一致ウィンドウの標準偏差を返します。
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$p1 = window.stddev($e.file.size) // yields 1.000000 if the event file size values in the match window are [1, 0, -1].
condition:
$e and #p1 > 10