Trim

This formatter searches for separator strings and removes all data left or right of this separator.

Parameters

LeftSeparator

The string to search for. Searching starts from the left side of the data. If an empty string is given this parameter is ignored. By default this parameter is set to “”.

RightSeparator

The string to search for. Searching starts from the right side of the data. If an empty string is given this parameter is ignored. By default this parameter is set to “”.

LeftOffset (default: 0)

Defines the search start index when using LeftSeparator. By default this parameter is set to 0.

RightOffset (default: 0)

Defines the search start index when using RightSeparator. Counting starts from the right side of the message. By default this parameter is set to 0.

Parameters (from core.SimpleFormatter)

ApplyTo

This value chooses the part of the message the formatting should be applied to. Use “” to target the message payload; other values specify the name of a metadata field to target. By default this parameter is set to “”.

SkipIfEmpty

When set to true, this formatter will not be applied to data that is empty or - in case of metadata - not existing. By default this parameter is set to false

Examples

This example will reduce data like “foo[bar[foo]bar]foo” to “bar[foo]bar”.

exampleConsumer:
  Type: consumer.Console
  Streams: "*"
  Modulators:
    - format.Trim:
      LeftSeparator: "["
      RightSeparator: "]"