Splunk Search

Using tokens in dropdown menu to create two different results

jialiu907
Path Finder

I am wondering if there's a way to use the dropdown menu and tokens to display two different results. I am trying to have the dropdown menu have static options of "read" and "write".

Read would display this search

 

index="collectd_test" plugin=disk type=disk_octets plugin_instance=dm-0
| spath output=values0 path=values{0}
| spath output=dsnames0 path=dsnames{0}
| stats  min(values0) as min max(values0) as max avg(values0) as avg by dsnames0
| eval min=round(min, 2)
| eval max=round(max, 2)
| eval avg=round(avg, 2)

 

Write would display this search

 

index="collectd_test" plugin=disk type=disk_octets plugin_instance=dm-0
| spath output=values1 path=values{1}
| spath output=dsnames1 path=dsnames{1}
| stats  min(values1) as min max(values1) as max avg(values1) as avg by dsnames1
| eval min=round(min, 2)
| eval max=round(max, 2)
| eval avg=round(avg, 2)

 

 

The only change in the searches as you can see is just the elements in the multivalue field.

If there is a way to append the search and have it shown together, that would be helpful as well.

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Set up your dropdown so the value for read is 0 and the value for write is 1 then use the token in the search

index="collectd_test" plugin=disk type=disk_octets plugin_instance=dm-0
| spath output=values$token$ path=values{$token$}
| spath output=dsnames$token$ path=dsnames{$token$}
| stats  min(values$token$) as min max(values$token$) as max avg(values0) as avg by dsnames$token$
| eval min=round(min, 2)
| eval max=round(max, 2)
| eval avg=round(avg, 2)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Set up your dropdown so the value for read is 0 and the value for write is 1 then use the token in the search

index="collectd_test" plugin=disk type=disk_octets plugin_instance=dm-0
| spath output=values$token$ path=values{$token$}
| spath output=dsnames$token$ path=dsnames{$token$}
| stats  min(values$token$) as min max(values$token$) as max avg(values0) as avg by dsnames$token$
| eval min=round(min, 2)
| eval max=round(max, 2)
| eval avg=round(avg, 2)
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...