Splunk® Enterprise

Search Reference

Acrobat logo Download manual as PDF


Acrobat logo Download topic as PDF

setfields

This feature is deprecated.
The setfields command is deprecated in the Splunk platform as of version 9.0.0. It might be removed in a future version. See the Release Notes.

Description

Sets the field values for all results to a common value.

Sets the value of the given fields to the specified values for each event in the result set. Delimit multiple definitions with commas. Missing fields are added, present fields are overwritten.

Whenever you need to change or define field values, you can use the more general purpose eval command. See usage of an eval expression to set the value of a field in Example 1.

Syntax

setfields <setfields-arg>, ...

Required arguments

<setfields-arg>
Syntax: string="<string>", ...
Description: A key-value pair, with the value quoted. If you specify multiple key-value pairs, separate each pair with a comma. Standard key cleaning is performed. This means all non-alphanumeric characters are replaced with '_' and leading '_' are removed.

Examples

Example 1:

Specify a value for the ip and foo fields.

... | setfields ip="10.10.10.10", foo="foo bar"

To do this with the eval command:

... | eval ip="10.10.10.10" | eval foo="foo bar"

See also

eval, fillnull, rename

Last modified on 18 March, 2022
PREVIOUS
set
  NEXT
sichart

This documentation applies to the following versions of Splunk® Enterprise: 9.0.0, 9.0.1, 9.0.2, 9.0.3, 9.0.4, 9.0.5, 9.0.6, 9.0.7, 9.0.8, 9.1.0, 9.1.1, 9.1.2, 9.1.3, 9.2.0


Was this documentation topic helpful?


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