Format
This filter is used to format the received Message. It is based on
Go templates and it can load templates from the template_path
directory specified in the configuration file. All Sprig functions are available.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| type | STRING | “text” | specify the type of template to use : "text" or "html" |
| template | STRING | empty | a template could be specified directly here, instead of load it from file (supports templates) |
| file | STRING | empty | load the template from file (supports templates) |
| target | STRING | “main” | the field of the Message that should be used for the filter (it could be main or an extra field) |
In the template is allowed to use all the fields of the received Message: main or extra.
... | format(type="html", template="main : {{.main}} extra : {{.file_name}}") | ...Output
The new formatted text is sent to the next filter in the main field of the Message if the target parameter is not specified.
The extra fields do not undergo changes.
Examples
Soon…