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