Dashboards & Visualizations

Drop Down - Dashboard

Ram2
Explorer

Hi All,  Created a drop down for index but when i added the token value in the panel query not working as expected when i select ALL option from the drop down.
But when i select DEV_INDEX or SIT_INDEX its working fine.
How to tweak the code to show up 2 indexes  data in the panel query when we select ALL option from the drop down???

<form version="1.1" theme="light">
<label>Dashboard</label>
<fieldset submitButton="false">
<input type="time" token="timepicker">
<label>TimeRange</label>
<default>
<earliest>-60m@m</earliest>
<latest>now</latest>
</default>
</input>
<input type="dropdown" token="Index" searchWhenChanged="true">
<label>Indexes</label>
<choice value="dev_index, sit_index">All</choice>
<choice value="dev_index">DEV_INDEX</choice>
<choice value="sit_index">SIT_INDEX</choice>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Total Count</title>
<search>
<query>index IN ("$index$") source=application.logs |stats count by codes</query>
<earliest>timepicker.earliest</earliest>
<latest>timepicker.latest</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">20</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentageRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>
<form>

 

Labels (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

When your token is expanded in your search, it becomes

index IN ("dev_index, sit_index")...

so that is actually a SINGLE value, which will never match.

There are several ways, but the simplest for you is to just remove the quotes around your search definition, so

index IN ($index$)...
0 Karma

Ram2
Explorer

I tried to use  as shown below:

index IN ($index$)...

  but my token expanded in search its taking up as  index IN (*), which is not working, can u suggest other solution.

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Not sure how your token can be * as there is nothing defined like that, but you DO have a mismatch between your defined token in the input and it's use

<input type="dropdown" token="Index" searchWhenChanged="true">

where it's upper case Index and you are using it as lower case $index$

Ram2
Explorer

Hi @bowesmana , yes your correct. Now I corrected it it's working as expected.

Thank you 😊 

 

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

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

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...