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
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...