Splunk Search

Does the fields command support globbing/wildcard matching?

chris
Motivator

Im trying to reduce the fields of my resultset by using the fields command with the '-' option. This does not appear to work:

index=* | head 10 | eval ip="194.10.10.10" | table ip,_time | geoip ip | fields - ip_* 

I can get around the problem for this case by searching differently:

index=* | head 10 | eval ip="194.10.10.10"  | geoip ip  | table ip,_time

...but I'm trying to find out how field command works.

The documentation shows an example where the * can be used if you want to keep fields (without using the '-').

This does work

index=* | head 10 | eval ip="194.10.10.10" | table ip,_time | geoip ip | fields ip_l*

This does not work:

index=* | head 10 | eval ip="194.10.10.10" | table ip,_time | geoip ip | fields - ip_l*

Any Ideas?

Thanks
Chris

0 Karma

HattrickNZ
Motivator

using 6.3.
having a similar issue:

For clarification:
| fields ip_l* this wild card will work in showing all the fields ip_l
but if I try and remove them.
| fields - ip_l* this does not remove the columns/field but it does remove the values in them columns ip_l*. I want the fields/columns to be removed as well.

hmmm....

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

This works for me. What version are you using?

0 Karma

chris
Motivator

Hi Ayn, you're right. I forgot to insert the '-' option to the last command. I updated the question.

0 Karma

Ayn
Legend

The two last examples seem to be identical?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Index This | How many sevens are there between 1 and 100?

August 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...