...
- If no
copy_first
,copy_last
,copy_highest,
orcopy_present
copy_groupby
directives are present, then a backwards-compatible directive 'copy_last => [ qr// ]'
copy_last => [ qr// ]'
is added is added. - (opEvents 2.2 and newer only)
copy_present
is evaluated first. It specifies which properties should be set from their first occurrence.
This rule must contain explicit property names only, i.e. no regular expressions.
opEvents checks all trigger events in chronological order, and when it finds an event that has a value for the desired property, it copies that value over and stops looking for that property. Any later events that might have the property as well do not contribute to the result.
A rule likecopy_present => [ 'alpha', 'beta' ]
will pull thealpha
andbeta
properties from wherever they are present for the first time, but independent of each other: a trigger event can contribute none, either or both properties. copy_first
is evaluated firstnext, and specifies which event properties should be copied over from the earliest trigger event.
Each listed property is copied over; if the directive contains a regular expression (e.g.qr/cust.*/
, then all properties with names matching the regular expression are copied.copy_last
is checked next, and properties listed here are copied over from the most recent trigger event.
The property copying does overwrite all properties that were set earlier (bycopy_first
).copy_highest
is checked next, and its properties are sourced from the trigger event with the highest priority.
Again overwriting of properties may happen.copy_groupby
controls whether any of the grouping property values should be saved in the new event.
The format is different for this directive: It must be a list of property target names (or the word 'undef'), in the same order as thegroupby
directive.
For each element in thegroupby
list, the value of the grouping property is saved as the target name in the new event, if a target name is available in thecopy_groupby
list.
If nogroupby
is given for this rule, then acopy_groupby
directive has no effect.- Now the
enrich
clause is checked, and each of its property name - value pairs indicates which properties should be set to (or overwritten with) a particular static value. - Now the
node
,stateful
andelement
properties are automatically adjusted if required (see below for details). - Finally, the event name is set to the rule name, certain undesirable properties are removed, an audit trail of triggering events is added (by adding the properties
nodes
andeventids
), the event is marked assynthetic
and is inserted into the database.
Please note that "earliest event" in step 1 2, 3 and 4 refers to the event with the earliest event timestamp, which does not necessarily reflect its processing order. opEvents processes inputs mostly - but not always - in chronological order. If you have multiple 'earliest' events (all with the same timestamp) then their order is undefined and copy_first
will pick a random event. The same caveat applies in step 2 for the "most recent event".
...