SML (RTC)
Streaming Correlator uses its own SML dialect, SML (RTC), for rule conditions. An expression in this dialect is evaluated for every incoming event and returns a Boolean value: true or false. SML (RTC) includes most standard SML functions and extends them with functions designed for streaming event processing.
Where It Is Used
SML (RTC) expressions are configured in the following fields of the rule and active list editors:
Firing Conditionof a declarative rule, evaluated for every event. See Declarative RulesPre-filterof an aggregation rule andFilterof an individual metric. See Aggregation RulesFiring Conditionof an aggregation rule, which operates on metric names rather than event fieldsPre-filterof an imperative rule,Conditionof anEventstage, andEvent That Cancels the Incidentof anAbsencestage. See Imperative RulesStream Filterof an active list, which selects events for automatic population. See Active Lists
All these fields except the Firing Condition of an aggregation rule are evaluated against incoming event fields. Otherwise, the dialect behaves consistently regardless of which field contains the expression.
Referencing Event Fields
An event field is written as a dot-separated path. A path that begins with @ is written without quotes. If a field name contains a space or other characters outside the usual set, enclose it in single quotes:
event.code == "4625"
@timestamp != nil
'user name' == "admin"
'x-forwarded-for' != nil
Single quotes denote a field and double quotes denote a string. A name in single quotes is one whole path: dots inside it are not split into segments.
A field name that collides with a function name must also be enclosed in single quotes, otherwise the expression is rejected when the rule is saved. This applies only to the first path segment: match.name is valid, while a bare now is not and must be written as 'now'.
Logical field names defined by the rule's Field Mapping are used in an expression alongside physical ones. See Streaming Jobs.
Operators
| Category | Operators |
|---|---|
| Logical | and, or, not and their equivalents &&, ||, ! |
| Comparison | ==, !=, <, <=, >, >= |
| Arithmetic | +, -, *, /, % |
| Grouping | Parentheses |
Literals
| Literal | Notation |
|---|---|
| String | Double quotes: "4625" |
| Number | 4625, 3.5, -1 |
| Boolean | true, false |
| Absent value | null |
Condition Language Functions
Reference for SML (RTC) dialect functions: a table of functions shared with standard SML and a detailed description of the correlator own functions with syntax and examples.