SplitToJSON¶
SplitToJSON is a formatter that splits a message by a given token and puts the result into a JSON object by using an array based mapping .
Parameters¶
- SplitToJSONDataFormatter
- SplitToJSONDataFormatter defines the formatter to apply before executing this formatter. Set to “format.Forward” by default.
- SplitToJSONToken
- SplitToJSONToken defines the separator character to use when processing a message. By default this is set to “|”.
- SplitToJSONKeepJSON
- SplitToJSONKeepJSON can be set to false to escape texts that are JSON payloads as regualar strings. Otherwise JSON payload will be taken as-is and set to the corresponding key. By default set to “true”.
- SplitToJSONKeys
- SplitToJSONKeys defines an array of keys to apply to the tokens generated by splitting a message by SplitToJSONToken. The keys listed here are applied to the resulting token array by index. This list is empty by default.
Example¶
- "stream.Broadcast":
Formatter: "format.SplitToJSON"
SplitToJSONDataFormatter: "format.Forward"
SplitToJSONToken: "|"
SplitToJSONKeys:
- "timestamp"
- "server"
- "error"