Splunk Search

Find All fieldnames for fields which contain a specified value

essklau
Path Finder

Hello,

My question is whether or not I can, via sp, return a list of all fieldnames which contain a specified value.

For instance, if I was looking for "superstar", can I construct a search which will return all fields which contain "superstar" as a value?

Thanks

Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Sure. With splunkd being our superstar, you can do this:

index=_internal | fields - tag::*
| foreach * [eval fieldnames = if(<<FIELD>>=="splunkd", mvappend(fieldnames, "<<FIELD>>"), fieldnames)]
| stats values(fieldnames)

For me that yields series (from metrics logs) and sourcetype (obvious).

Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...