Simple Templating to Transform Message Fields into Strings

1. Functions

1.1. interpolate

Interpolates values from the currently processed message into the provided string value. A %{} enclosed field name will be replaced by the field value from the current message. All message header fields are supported ("Uuid", "Timestamp", "Type", "Logger", "Severity", "Payload", "EnvVersion", "Pid", "Hostname"). Any other values will be checked against the defined dynamic message fields. If no field matches, then a C strftime (*nix) or C89 strftime (Windows) time substitution will be attempted. The time used for time substitution will be the seconds-from-epoch timestamp passed in as the secs argument, if provided. If secs is nil, local system time is used. Note that the message timestamp is not automatically used; if you want to use the message timestamp for time substitutions, then you need to manually extract it and convert it from nanoseconds to seconds (i.e. divide by 1e9).


  • value (string) - String into which message values should be interpolated.
  • secs (number or nil) - Timestamp (in seconds since epoch) to use for time substitutions. If nil, system time will be used.


  • string - Original string value with any interpolated message values.

source code: msg_interpolate.lua

results matching ""

    No results matching ""