Introduction
antonmedv/expr - Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing
Several places of CrowdSec's configuration use expr, notably :
- Filters that are used to determine events eligibility in parsers, scenarios and profiles
- Statics use expr in the
expressiondirective, to compute complex values - Whitelists rely on
expressiondirective to allow more complex whitelists filters - Profiles rely on
filtersdirectives to find matching profiles
To learn more about expr syntax, check the official documentation of the project.
When CrowdSec relies on expr, a context is provided to let the expression access relevant objects :
evt.is the representation of the current event and is the most relevant object- in profiles, alert is accessible via the
Alertobject
If the debug is enabled (in the scenario or parser where expr is used), additional debug will be displayed regarding evaluated expressions.