Flatten

This formatter takes a metadata tree and moves all subkeys on the same level as the root of the tree. Fields will be named according to their hierarchy but joining all keys in the path with a given separator.

Parameters

Separator (default: .)

Defines the separator used when joining keys. By default this parameter is set to “.”

Parameters (from core.SimpleFormatter)

Source

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

Target

This value chooses the part of the message the formatted data should be stored 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 “”.

ApplyTo

Use this to set Source and Target to the same value. This setting will be ignored if either Source or Target is set to something else but “”. 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 will flatten all elements below the key “tree” on the root level. A key /tree/a/b will become /tree.a.b

ExampleConsumer:
  Type: consumer.Console
  Streams: console
  Modulators:
    - format.Flatten:
      Source: tree