Adding, removing, and updating fields with DSP
You can add, remove, and update fields at ingestion time with the Data Stream Processor (DSP).
Adding fields
To add a new top-level field to your data, use the eval function. The eval function adds or updates an existing field to your record.
- From the Data Pipelines editor, click on the + icon and add the Eval function to your pipeline.
- Enter the Eval expression that defines the field value.
For example, to add a new field called "User" to your data that contains the value ofhost
, typeas(get("host"), "User");
in your eval function. - With your Eval function highlighted, click Start Preview to verify that the expression is working as expected.
Updating fields
To manipulate an existing field, use the eval function. The eval function adds or updates an existing field to your record.
- From the Data Pipelines editor, click the + icon and add the Eval function to your pipeline.
- Enter the eval expression that defines the field value.
For example, to append to the existing body fieldPrice
, type the following in your Eval function.as( concat( literal("price="), cast(get("body"), "string") ), "body" );
- With your Eval function highlighted, click Start Preview to verify that the expression is working as expected.
Removing fields
To remove fields from your data, use the Fields or Normalize functions.
Use the Fields function to only keep selected fields in your events.
- From the Data Pipelines Canvas view, click the + icon and add the Fields function to your pipeline.
- In the Fields function, enter the fields you want to keep in your data.
For example, to keep only the host and source fields, typehost
, click Add, and typesource
. - With your Fields function highlighted, click Start Preview to verify that the expression is working as expected.
Use the Normalize function to remove fields in your events.
- From the Data Pipelines Canvas view, click the + icon and add the Normalize function to your pipeline.
- In the Normalize function, click Delete on the fields that you want to remove.
- With your Normalize function highlighted, click Start Preview to verify that the expression is working as expected.
Aggregate records in a DSP pipeline | Extracting fields in DSP |
This documentation applies to the following versions of Splunk® Data Stream Processor: 1.0.0
Feedback submitted, thanks!