Type | Sample | Description |
---|---|---|
Text | Some text | You may, of course, add generic text content to your liking. |
Variable | {{ var }} | Extract content of the event and insert it. Note: there is no further sanitizing of the values. |
Accessing nested variables | {{ var . subfield . evenMore }} | Access sub fields |
Accessing fields of an array | {{ var.arrayField [0] .more }} | Access array contents |
Access more complex keys | {{ var.compl:ex\ key-123.noproblem }} | Complex keys can be accessed by escaping whitespaces or simply writing them out e.g. colons. No index style needed. |
Applying functions to variables | {{var.lowerCase () }} | See Functions below, for a list of all functions. |
Passing arguments to functions | {{var.splitTakeAt( "one two", 10 )}} | |
Sections (if/else blocks) |
| See Sections below. |
Loops (for blocks) |
| See Loops below. |
Function | Description | Parameters |
---|---|---|
substring | Displays characters from the given start index(1) to the specified end index(2). (It is required to provide at least one parameter.) | substring(Integer(1)) substring(Integer(1), Integer(2)) |
lowerCase | Displays characters in lower case. | |
upperCase | Displays characters in upper case. | |
replaceAll | Replaces each of a given character sequence(1) with a new sequence(2). | replaceAll(String(1), String(2)) |
splitTakeAt | Divides a string into an array of substrings based on a character sequence as the delimiter. | splitTakeAt(String(1), Integer(2)) |
startsWithTake | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it matches. | startsWithTake(String(1), String(2)) |
equalsTake | Matches a given character sequence(1) with a variable's value and replaces it with a different character sequence(2) if it matches. | equalsTake(String(1), String(2)) |
endsWithTake | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it matches. | endsWithTake(String(1), String(2)) |
containsTake | Replaces a variable's value with a character sequence(2) if it contains a given character sequence(1). | containsTake(String(1), String(2)) |
startsWithTakeOrDrop | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it matches; otherwise, it does not display anything. | startsWithTakeOrDrop(String(1), String(2)) |
equalsTakeOrDrop | Matches a given character sequence(1) with a variable's value and replaces it with a different character sequence(2) if it matches; otherwise, it does not display anything. | equalsWithTakeOrDrop(String(1), String(2)) |
endsWithTakeOrDrop | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it matches; otherwise, it does not display anything. | endsWithTakeOrDrop(String(1), String(2)) |
containsTakeOrDrop | Replaces a variable's value with a character sequence(2) if it contains a given character sequence(1); otherwise, it does not display anything. | containsTakeOrDrop(String(1), String(2)) |
startsWithElse | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it doesn't match. | startsWithElse(String(1), String(2)) |
equalsElse | Matches a given character sequence(1) with the variable's value and replaces it with a different character sequence(2) if it doesn't match. | equalsElse(String(1), String(2)) |
endsWithElse | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it doesn't match. | endsWithElse(String(1), String(2)) |
containsElse | Replaces a variable's value with a character sequence(2) if it doesn't contain a given character sequence(1). | containsElse(String(1), String(2)) |
startsWithElseOrDrop | Matches a given character sequence(1) with the start of a variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | startsWithElseOrDrop(String(1), String(2)) |
equalsElseOrDrop | Matches a given character sequence(1) with the variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | equalsElseOrDrop(String(1), String(2)) |
endsWithElseOrDrop | Matches a given character sequence(1) with the end of a variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | endsWithElseOrDrop(String(1), String(2)) |
containsElseOrDrop | Matches a given character sequence(1) with a variable's value and replaces it with a different character sequence(2) if it doesn't match; otherwise, it does not display anything. | containsElseOrDrop(String(1), String(2)) |
formatUnixMs | Formats a variable's value from milliseconds into ISO-8601 date-time format. Additionally, it accepts a format style character (1) as a parameter.
Any other character will lead to medium text style as default. | formatUnixMs() formatUnixMs(String(1)) |
formatUnixSec | Formats a variable's value from seconds into ISO-8601 date-time format. Additionally, it accepts a format style character (1) as a parameter.
Any other character will lead to medium text style as default. | formatUnixSec() formatUnixSec(String(1)) |
formatDateString | Formats a variable's value into ISO-8601 date format. Additionally, it accepts a format style character (1) as a parameter.
Any other character will lead to medium text style as default. | formatDateString() formatDateString(String(1)) |
join | Displays a text composed of array values joined by a given delimiter(1). If no delimiter is provided, the function defaults to ", " . | join() join(String(1)) |
joinFromObjectArray | Displays a text composed of object array(1) values joined by a given delimiter(2). If no delimiter is provided, the function defaults to a new line. | joinFromObjectArr(String(1)) joinFromObjectArr(String(1), String(2)) |
extractRegex | Extract a regex from a string field. | extractRegex(String(1)) |
extractRegexGroups | Extract regex groups from a string field. Group extraction results are concatted without delimiter. | extractRegexGroups(String(1)) |
Function | Sample | Input data | Output |
---|---|---|---|
substring | {{ var.substring(3) }} {{ var.substring(5, 7) }} |
| result res |
lowerCase | {{ var.lowerCase() }} |
| gavin belson from hooli |
upperCase | {{ var.upperCase() }} |
| GAVIN BELSON FROM HOOLI |
replaceAll | {{ var.replaceAll("Gavin Belson", "Richard Hendricks") }} |
| Richard Hendricks owns Hooli |
splitTakeAt | {{ var.splitTakeAt("Belson, ", 1) }} |
| Richard Hendricks and Russ Hanneman are in the tres commas club |
startsWithTake | {{ var.startsWithTake("I am the best", "In your dreams - Bertram Gilfoyle") }} |
| In your dreams - Bertram Gilfoyle |
equalsTake | {{ var.equalsTake("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }} |
| Not true - Bertram Gilfoyle |
endsWithTake | {{ var.endsWithTake("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }} |
| Flys - Bertram Gilfoyle |
containsTake | {{ var.containsTake("rocks", "Pied Piper rocks") }} |
| Pied Piper rocks |
startsWithTakeOrDrop | {{ var.startsWithTakeOrDrop("I am the best", "In your dreams - Bertram Gilfoyle") }} | 1:
| 1: In your dreams - Bertram Gilfoyle 2: |
equalsTakeOrDrop | {{ var.equalsTakeOrDrop("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }} | 1:
| 1: Not true - Bertram Gilfoyle 2: |
endsWithTakeOrDrop | {{ var.endsWithTakeOrDrop("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }} | 1:
| 1: Flys - Bertram Gilfoyle 2: |
containsTakeOrDrop | {{ var.containsTakeOrDrop("rocks", "Pied Piper rocks") }} | 1:
| 1: Pied Piper rocks 2: |
startsWithElse | {{ var.startsWithElse("I am the best", "In your dreams - Bertram Gilfoyle") }} | 1.
| 1: I am the best software engineer at Pied Piper - Dinesh Chugtai 2: In your dreams - Bertram Gilfoyle |
equalsElse | {{ var.equalsElse("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }} | 1:
| 1: I am better than Gilfoyle - Dinesh Chugtai 2: Not true - Bertram Gilfoyle |
endsWithElse | {{ var.endsWithElse("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }} | 1:
| 1: I am the fastest coder - Dinesh Chugtai 2: Flys - Bertram Gilfoyle |
containsElse | {{ var.containsElse("rocks", "Pied Piper rocks") }} | 1:
| 1: Hooli rocks 2: Pied Piper rocks |
startsWithElseOrDrop | {{ var.startsWithElseOrDrop("I am the best", "In your dreams - Bertram Gilfoyle") }} | 1.
| 1: 2: In your dreams - Bertram Gilfoyle |
equalsElseOrDrop | {{ var.equalsElseOrDrop("I am better than Gilfoyle - Dinesh Chugtai", "Not true - Bertram Gilfoyle") }} | 1:
| 1: 2: Not true - Bertram Gilfoyle |
endsWithElseOrDrop | {{ var.endsWithElseOrDrop("Dinesh Chugtai", "Flys - Bertram Gilfoyle") }} | 1:
| 1: 2: Flys - Bertram Gilfoyle |
containsElseOrDrop | {{ var.containsElseOrDrop("rocks", "Pied Piper rocks") }} | 1:
| 1: 2: Pied Piper rocks |
formatUnixMs | {{ var.formatUnixMs() }} {{ var.formatUnixMs("S") }} |
| 1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM |
formatUnixSec | {{ var.formatUnixSec() }} {{ var.formatUnixSec("S") }} |
| 1: Jan 29, 2023, 12:05:37 AM 2: 1/29/23, 12:05 AM |
formatDateString | {{ var.formatDateString() }} {{ var.formatDateString("S") }} |
| 1: May 25, 2021, 9:24:56 PM 2: 5/25/21, 9:24 PM |
join | {{ var.join() }} {{ var.join("- ") }} |
| 1: PiedPiper, Hooli, "Aviato" 2: PiedPiper- Hooli- Aviato |
joinFromObjectArray | {{ companies.joinFromObjectArr("name") }} {{ companies.joinFromObjectArr("ceo", "+") }} |
| 1: PiedPiper Hooli NewPiedPiper Raviga 2: PiedPiper+Hooli+NewPiedPiper+Raviga |
extractRegex |
|
|
|
extractRegexGroups |
|
|
|
{{ #nested }}
{{ name }}
{{ /nested }}
{% endtab %}
{% endtabs %}
*Using the following context:*
```json
{
"simple": ["Pied Piper", "Hooli", "Raviga"],
"nested": [
{ "name": "Richard Hendricks" },
{ "name": "Gavin Belson" },
{ "name": "Peter Gregory" }
]
}
```
{% tabs %}
{% tab title="Simple array output" %}
```
Pied Piper
Hooli
Raviga
```
{% endtab %}
{% tab title="Nested array output" %}
```
Richard Hendricks
Gavin Belson
Peter Gregory
```
{% endtab %}
{% endtabs %}