Skip to content

Commit 79e6587

Browse files
author
Birger Schacht
committed
DOC: add documentation about sieve expression chaining
It is possible to chain expressions in custom sieve language, but the documentation stated otherwise. This updates the documentation and adds and example.
1 parent ced091b commit 79e6587

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

docs/user/bots.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,10 +2451,12 @@ rules are specified in an external configuration file and with a syntax *similar
24512451
to the `Sieve language <http://sieve.info>`_ used for mail filtering.
24522452

24532453
Each rule defines a set of matching conditions on received events. Events can be
2454-
matched based on keys and values in the event. If the processed event matches a
2455-
rule's conditions, the corresponding actions are performed. Actions can specify
2456-
whether the event should be kept or dropped in the pipeline (filtering actions)
2457-
or if keys and values should be changed (modification actions).
2454+
matched based on keys and values in the event. Conditions can be combined using
2455+
parenthesis and the boolean operators ``&&`` and ``||``. If the processed event
2456+
matches a rule's conditions, the corresponding actions are performed. Actions
2457+
can specify whether the event should be kept or dropped in the pipeline
2458+
(filtering actions) or if keys and values should be changed (modification
2459+
actions).
24582460

24592461
**Requirements**
24602462

@@ -2522,7 +2524,8 @@ Each rule specifies on or more expressions to match an event based on its keys
25222524
and values. Event keys are specified as strings without quotes. String values
25232525
must be enclosed in single quotes. Numeric values can be specified as integers
25242526
or floats and are unquoted. IP addresses and network ranges (IPv4 and IPv6) are
2525-
specified with quotes. Parentheses in expression statements are not possible.
2527+
specified with quotes. Expression statements can be combined and chained using
2528+
parenthesis and the boolean operators ``&&`` and ``||``.
25262529
The following operators may be used to match events:
25272530

25282531
* `:exists` and `:notexists` match if a given key exists, for example:
@@ -2557,6 +2560,10 @@ The following operators may be used to match events:
25572560
Events with values like `8.8.8.8` or `8.8.4.4` will match, as they are always unequal to the other value.
25582561
The result is *not* that the field must be unequal to all given values.
25592562

2563+
* The combination of multiple expressions can be done using parenthesis and boolean operators:
2564+
2565+
``if (source.ip == '127.0.0.1') && (comment == 'add field' || classification.taxonomy == 'vulnerable') { ... }``
2566+
25602567

25612568
*Actions*
25622569

0 commit comments

Comments
 (0)