Adding, removing, and updating fields
You can add, update, and remove fields with the Data Stream Processor.
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
, typeuser=host
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 on 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.body=concat("price=", cast(body, "string"))
- With your Eval function highlighted, click Start Preview to verify that the expression is working as expected.
Removing fields
Use the Fields function to only keep selected fields in your events or remove specific fields from your events.
- From the Data Pipelines Canvas view, click on the + icon and add the Fields function to your pipeline.
- If you want to only keep specific fields in your data, then:
- In the Fields function, enter the fields you want to keep in your data in field_list. For example, to keep only the host and source fields, type
host, source
in the field_list .
- In the Fields function, enter the fields you want to keep in your data in field_list. For example, to keep only the host and source fields, type
- If you want to remove specific fields in your data, then:
- In the Fields function, enter the fields you want to remove from your data in the field_list and type
-
in the operator field. For example, to remove the source field, typesource
in the field_list and-
in the operator field.
- In the Fields function, enter the fields you want to remove from your data in the field_list and type
- With your Fields function highlighted, click Start Preview to verify that the expression is working as expected.
Add a sourcetype | Extracting fields in events data |
This documentation applies to the following versions of Splunk® Data Stream Processor: 1.1.0
Feedback submitted, thanks!