JEXL Filter Expressions
The event filter, the alarm filter, the ticket filter, the case filter and the field mapping rules use the same expression language.
The CMDB filter uses the ServiceNow query syntax, not JEXL.
Rules
-
An empty filter lets every item through.
-
A filter with a syntax error is rejected at save time with an error message. The previous filter stays.
-
When a filter fails at runtime, the item goes through.
Syntax
Filters use the Apache JEXL 3 syntax.
| Operator | Description |
|---|---|
|
Equal, not equal |
|
Numeric comparison |
|
Regular expression match of the full string. Use |
|
No regular expression match |
|
Logical operators |
Examples
# Alarms with severity MAJOR or higher, by number
alarm.severity.id >= 6
# CRITICAL alarms only, by name
alarm.severity.name() == 'CRITICAL'
# The same by label, which has one capital
alarm.severity.label == 'Critical'
# No internal events, and only MINOR or higher
!(event.uei =~ 'uei.opennms.org/internal/.*') and event.severity.id >= 5
# Acknowledged alarms from one location
alarm.acknowledged and alarm.node.location == 'DC-East'
# A part of the description
alarm.description =~ '.*disk space.*'
# Ticket filter with an IP address
alarm.reductionKey =~ 'uei.opennms.org/threshold/.*' and ticket.ipAddress =~ '10.0.1.*'