Dashboards & Visualizations

Dashboard Drop Down

vishwa
Path Finder

We created a dynamic drop down for service code and time range. We have many  service code values out of which "null"  is one of  them. So when we select a particular time range if null value logs are not present also it is showing up in the drop down, We want to see the options in the drop down only if that logs are present during that time.

Below is the xml code used:

<form version="1.1" theme="light">
<label>Dashboard</label>
<fieldset submitButton="false">
<input type="time" token="timepicker">
<label>TimeRange</label>
<default>
<earliest>-15m@m</earliest>
<latest>now</latest>
</default>
</input>
<input type="dropdown" token="ServiceCode">
<label>ServCode</label>
<choice value="*">All</choice>
<default>*</default>
<fieldForLabel>ServiceCode</fieldForLabel>
<fieldForValue>ServiceCode</fieldForValue>
<search>
<query> index=app-index |rename "resource.attributes.servicecode" as ServiceCode
|stats count by ServiceCode
|fields ServiceCode </query>
<earliest>timepicker.earliest</earliest>
<latest>timepicker.latest</latest>
</search>
</input>
</fieldset>
<row>
<panel>
<table>
<title>Incoming Count</title>
<search>
<query>index=app-index source=application.logs AND resource.attributes.servicecode="$ServiceCode$"
 |table Income Rej_app ATM DMM Reject Rej_log Rej_app
</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

vishwa
Path Finder

can anyone help on this, not knowing what is the issue.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Do you mean that resource.attributes.servicecode has a string value of "null" in some of your events and you want to exclude that from your list of available options in your dropdown?

<query> index=app-index |rename "resource.attributes.servicecode" as ServiceCode
|stats count by ServiceCode
|where ServiceCode != "null"
|fields ServiceCode </query>
0 Karma

vishwa
Path Finder

Hi @ITWhisperer , No my ask is for example in servicode we have below values

2031
1345
2345
null
5643

when i select time range as 24 hours we have data for all above codes so they are all showing up in the ServiceCode drop down. but when i select time range for last 15 mins there are no logs for "null" but still it is showing up in the drop down.
We dont want to see null option if logs are not present.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try this

<earliest>$timepicker.earliest$</earliest>
<latest>$timepicker.latest$</latest>
0 Karma

vishwa
Path Finder

i am already using that its in xml code.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It isn't in the XML code you posted

0 Karma

vishwa
Path Finder

pls find the screenshot below, let me know where i am missing it pls

vishwa_0-1719427683731.png

 

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!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...