Alarm or collection filter
You can validate the content of an alarm, a collection or any map structured object with one or multiple filters.
A filter compare a content
with the value of the given field
based on an operation
.
- Filter.content
Value to compare with. Type depend on the type of the field or on the chosen operation.
- Filter.operation
Operation to apply. The following operation are currently available:
EQUAL
: values are the sameNOT_EQUAL
: values are differentGREATER_THAN
: value from data greater than filter contentGREATER_THAN_EQUAL
: value from data greater than or equal to filter contentLESS_THAN
: value from data lesser than filter contentLESS_THAN_EQUAL
: value from data lesser than or equal to filter contentCONTAIN
: (array only) value contain filter contentNOT_CONTAIN
: (array only) value doesn’t contain filter contentSTART_WITH
: value starts with filter contentEND_WITH
: value ends with filter contentArray size comparison:
SIZE_EQUAL
: (arrays only) values size are the sameSIZE_NOT_EQUAL
: (arrays only) values size are differentSIZE_GREATER_THAN
: (arrays only) value size from data greater than filter content sizeSIZE_GREATER_THAN_EQUAL
: (arrays only) value size from data greater than or equal to filter content sizeSIZE_LESS_THAN
: (arrays only) value size from data lesser than filter content sizeSIZE_LESS_THAN_EQUAL
: (arrays only) value size from data lesser than or equal to filter content size
Relatives date comparison:
(dates only) filter content as seconds represent the difference between now and the targeted timestamp in the past (i.e content as 5 means 5 seconds in the past).
NEWER_THAN
: The value (as a date) is newer than the filter content if the value is closer to now than the targeted timestamp. If content is 0, the target timestamp being set as now, nothing could match the filter.NEWER_THAN_EQUAL
: The value (as a date) is newer than or equal to the filter content if the value is closer or equal to now than the targeted timestamp. If content is 0, the target timestamp being set as now, only match if strictly equal.OLDER_THAN
: The value (as a date) is older than the filter content if the value is further in the past than the targeted timestamp. If content is 0, the target timestamp being set as now, every date set in the past will match.OLDER_THAN_EQUAL
: The value (as a date) is older than or equal to the filter content if the value is further in the past or equal than the targeted timestamp. If content is 0, the target timestamp being set as now, every date set in the past or equal will match.
ARRAY_BETWEEN
: filter content must be an array of 2. First element used in aGREATER_THAN_EQUAL
filter and second element in aLESS_THAN
filter. Is true if both are true -OR
: Content is an array of filters. If any one of those filters are true, then true. -AND
: Content is an array of filters. If every one of those filters are true, then true.
- Filter.field
Name of the field from the data we want to filter (i.e. from an alarm could be severity, source or any other field from an alarm).
- filters.allMatch(data: object, filters: object[])
Check if the provided data match all given filters.
- filters.anyMatch(data: object, filters: object[])
Check if the provided data match any given filters.