Dashboards & Visualizations

Use dropdown filled by query on dynamic field in fieldset section of XML

richtate
Path Finder

I have a dropdown that has dynamic data, changes by the day, that I want filled in the dropdown for selection and use in the dashboard.  I've followed several entries from the community but the dropdown is blank, only showing the ALL from the 'choice' entry.  Here is the SPL,

 

<fieldset submitButton="true">
 <input type="dropdown" token="tok_site" searchWhenChanged="false">
  <label>Site</label>
  <search>
   <query>earliest=-2h index=asset sourcetype=Armis:Asset
                    | stats count by site.name

   </query>
  </search>
  <choice value="*">ALL</choice>
  <default>*</default>
  <fieldForLabel>Site</fieldForLabel>
  <fieldForValue>Site</fieldForValue>
 </input>

</fieldset>

I will be adding a couple more dropdowns later, but they are dynamic as well.  If I can't get one to work, well..

Any suggestion on where I've made a mistake?

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The SPL <fieldForLabel> and <fieldForValue> elements say the Site field should be used to populate the dropdown, but that field does not exist.  The only fields produced by the query are count and site.name.  If you change the SPL to make sure the field names in the dropdown exist then it should work.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The SPL <fieldForLabel> and <fieldForValue> elements say the Site field should be used to populate the dropdown, but that field does not exist.  The only fields produced by the query are count and site.name.  If you change the SPL to make sure the field names in the dropdown exist then it should work.

---
If this reply helps you, Karma would be appreciated.

richtate
Path Finder

Yep, that was it, I changed the field value to site.name and it is working.  Thanks for pointing that out!

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...