Link Search Menu Expand Document Documentation Menu

Trim string processor

The trim_string processor removes white space from the beginning and end of a key.

Configuration

You can configure the trim_string processor with the following options.

Option Required Description
with_keys Yes A list of keys from which to trim the white space.

Usage

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

pipeline:
  source:
    file:
      path: "/full/path/to/logs_json.log"
      record_type: "event"
      format: "json"
  processor:
    - trim_string:
        with_keys:
          - "trimField"
  sink:
    - stdout:

Next, create a log file named logs_json.log. After that, replace the path in the file source of your pipeline.yaml file with the correct file path. For more detailed information, see Configuring OpenSearch Data Prepper.

Before you run Data Prepper, the source appears in the following format:

{"trimField": " Space Ship "}

After you run Data Prepper, the source is converted to the following format:

{"trimField": "Space Ship"}
350 characters left

Have a question? .

Want to contribute? or .