metadata

Performs operations on the metadata of a message. Metadata are key/value pairs that are associated with messages.

# Common config fields, showing default values
metadata:
operator: set
key: example
value: ${!hostname}

Metadata values can be referred to using configuration interpolation functions, which allow you to set fields in certain outputs using these dynamic values.

This processor will interpolate functions within both the key and value fields, you can find a list of functions here. This allows you to set the contents of a metadata field using values taken from the message payload.

Value interpolations are resolved once per batch. In order to resolve them per message of a batch place it within a for_each processor:

for_each:
- metadata:
operator: set
key: foo
value: ${!json_field:document.foo}

Operators

set

Sets the value of a metadata key.

delete

Removes all metadata values from the message where the key matches the value provided. If the value field is left empty the key value will instead be used.

delete_all

Removes all metadata values from the message.

delete_prefix

Removes all metadata values from the message where the key is prefixed with the value provided. If the value field is left empty the key value will instead be used as the prefix.

Fields

operator

The operator to apply to messages.

Type: string
Default: "set"
Options: set, delete, delete_all, delete_prefix.

key

The metadata key to target with the chosen operator. This field supports interpolation functions that are resolved batch wide.

Type: string
Default: "example"

value

The metadata value to use with the chosen operator. This field supports interpolation functions that are resolved batch wide.

Type: string
Default: "${!hostname}"

parts

An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Type: array
Default: []