Format

Format

This filter is used to format the received Message. It is based on
the Golang templates and it can load templates from the template_path
directory specified in the configuration file.

Parameters

ParameterTypeDefaultDescription
typeSTRING“text”specify the type of template to use : "text" or "html"
templateSTRINGemptya template could be specified directly here, instead of load it from file
fileSTRINGemptyload the template from file
targetSTRING“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