window.last
נתמך ב:
window.last(values_to_sort_by, values_to_return)
תיאור
פונקציית הצבירה הזו מחזירה ערך מחרוזת שנגזר מאירוע עם ערך ה-int הכי גבוה שקשור לחלון ההתאמה. תרחיש לדוגמה לשימוש: קבלת מזהה המשתמש מהאירוע עם חותמת הזמן הנמוכה ביותר בחלון ההתאמה (חותמת הזמן הגבוהה ביותר).
סוגי נתונים של פרמטרים
INT, STRING
סוג הערך שמוחזר
STRING
דוגמאות קוד
הפונקציה מחזירה ערך מחרוזת שנגזר מאירוע עם ערך שלם מתואם הכי גבוה בחלון ההתאמה.
rule test_windows_last {
// This rule sets the outcome $last_event to the highest correlated int value
// in the 5 minute match window.
meta:
events:
$e.principal.user.userid = $userid
match:
$userid over 5m
outcome:
$last_event = window.last($e.metadata.event_timestamp.seconds,
$e.metadata.vendor_name)
// yields v3 if the events in the match window are 1, 2 and 3 and
// corresponding values v1, v2, and v3.
condition:
$e
}