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
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!

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...