Splunk® Data Stream Processor

Function Reference

Download manual as PDF

Download topic as PDF

Fields

This topic describes how to use the function in the Splunk Data Stream Processor.

Description

Keeps or removes fields from your data based on the field list criteria.

Function Input/Output Schema

Function Input
collection<record<R>>
This function takes in collections of records with schema R.
Function Output
collection<record<S>>
This function outputs the same collection of records but with a different schema S.

Syntax

The required fields are in bold font.

fields [+|-] <field_list>

Required arguments

+ | -
Syntax: + | -
Description: If the plus ( + ) symbol is specified, only the fields in the field_list are kept in the results. If the negative ( - ) symbol is specified, the fields in the field_list are removed from the results. The symbol you specify applies to all of the fields in the field_list.
Default: +
field_list
Syntax: <field>, <field>, ...
Description: Comma-delimited list of fields to keep or remove. You can use a wild card character in the field names, but must enclose those field names in single quotation marks.

SPL2 examples

Examples of common use cases follow:

1. Specify a list of fields to keep in your records

Return only the host, source, and body fields.

... | fields host, source, body | ...

2. Specify a list of fields to remove from your records

Use the negative ( - ) symbol to specify which fields to remove from your incoming records. In this example, remove the host field from the records.

... | fields - host | ...
Last modified on 09 July, 2020
PREVIOUS
Extract Timestamp
  NEXT
From

This documentation applies to the following versions of Splunk® Data Stream Processor: 1.1.0, 1.2.0


Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters