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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...