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>
can anyone help on this, not knowing what is the issue.
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>
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.
Try this
<earliest>$timepicker.earliest$</earliest>
<latest>$timepicker.latest$</latest>
i am already using that its in xml code.
It isn't in the XML code you posted
pls find the screenshot below, let me know where i am missing it pls