Selecting fields - The fields command
All data that goes into Splunk is turned into events, and each part of an event is assigned to a specific field. The fields command lets you select or remove any field in our field list, which directly affects query performance.
To select the fields to use, pass the fields command the list of fields to keep, as in the following example:
index=web | fields action, clientip, host, status
Similarly, we can use the minus sign (-) to remove fields from the list:
index=web | fields - action, clientip, host, status
We can also remove or select fields by a prefix in their names. In the first image of this post, you will see several fields whose names start with the prefix "date". We can use the syntax below to remove all of these fields:
index=web | fields - date*
Want to practice? Try the free We Challenge sample, with Splunk questions and explanations.
To start from scratch, see the Introduction to Splunk course on Udemy (in Portuguese). For your team, see WeValuate's Splunk training.
Questions about the post? Content suggestions? Corrections? Criticism or praise?
Please contact us at wevaluatebr@gmail.com and we will reply as soon as possible.
If you liked it, share this post on your social networks and help us spread the word!



Comments