opensearch-project / data-prepper

Data Prepper is a component of the OpenSearch project that accepts, filters, transforms, enriches, and routes data at scale.
https://opensearch.org/docs/latest/clients/data-prepper/index/
Apache License 2.0
259 stars 190 forks source link

Update the mutate string processors to use the EventKey. #4649

Closed dlvenable closed 2 months ago

dlvenable commented 3 months ago

Description

Change the source and keys properties for mutate string processors to use EventKey such that they are parsed by Data Prepper core. Also, use the TestEventFactory in the tests to avoid use of JacksonEvent directly. Removes an unused class.

Tested against a processor chain that looks like:

  processor:
    - split_string:
        entries:
          - source: message
            delimiter: ','
    - uppercase_string:
        with_keys:
          - 'message/0'
          - 'message/1'
    - lowercase_string:
        with_keys:
          - 'message/2'
          - 'message/3'
    - trim_string:
        with_keys:
          - 'message/4'
          - 'message/5'
    - substitute_string:
        entries:
          - source: 'message/6'
            from: 'a{1}'
            to: '!'

Issues Resolved

Contributes toward #4646

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.