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