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)
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...