add_entries

The add_entries processor adds entries to an event.

Configuration

You can configure the add_entries processor with the following options.

OptionRequiredDescription
entriesYesA list of entries to add to an event.
keyYesThe key of the new entry to be added. Some examples of keys include my_key, myKey, and object/sub_Key.
valueYesThe value of the new entry to be added. You can use the following data types: strings, Booleans, numbers, null, nested objects, and arrays.
overwrite_if_key_existsNoWhen set to true, the existing value is overwritten if key already exists in the event. The default value is false.

Usage

To get started, create the following pipeline.yaml file:

  1. pipeline:
  2. source:
  3. ...
  4. ....
  5. processor:
  6. - add_entries:
  7. entries:
  8. - key: "newMessage"
  9. value: 3
  10. overwrite_if_key_exists: true
  11. sink:

copy

For example, when your source contains the following event record:

  1. {"message": "hello"}

And then you run the add_entries processor using the example pipeline, it adds a new entry, {"newMessage": 3}, to the existing event, {"message": "hello"}, so that the new event contains two entries in the final output:

  1. {"message": "hello", "newMessage": 3}

If newMessage already exists, its existing value is overwritten with a value of 3.

add_entries - 图1