Split string processor
The split_string
processor splits a field into an array using a delimiting character.
Configuration
The following table describes the options you can use to configure the split_string
processor.
Option | Required | Type | Description |
---|---|---|---|
entries | Yes | List | List of entries. Valid values are source , delimiter , and delimiter_regex . |
source | N/A | N/A | The key to split. |
delimiter | No | N/A | The separator character responsible for the split. Cannot be defined at the same time as delimiter_regex . At least delimiter or delimiter_regex must be defined. |
delimiter_regex | No | N/A | The regex string responsible for the split. Cannot be defined at the same time as delimiter . At least delimiter or delimiter_regex must be defined. |
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:
- split_string:
entries:
- source: "message"
delimiter: ","
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 your file path. For more detailed information, see Configuring OpenSearch Data Prepper.
Before you run Data Prepper, the source appears in the following format:
{"message": "hello,world"}
After you run Data Prepper, the source is converted to the following format:
{"message":["hello","world"]}