Dashboards & Visualizations

Why is the dashboard dropdown only showing 5 values from dynamic query?

dyapasrikanth
Path Finder

The below input field only showing 5 values in dropdown and no auto complete box. I can see it try to show all fields initially and at the end of the search it just showing 5 values + default value and this is not the case all the time. Some times it is not showing anything other than default value.

<input type="dropdown" token="env">
      <label>Environment</label>
      <default>prod</default>
      <initialValue>prod</initialValue>
      <fieldForLabel>Environment</fieldForLabel>
      <fieldForValue>env_name</fieldForValue>
      <search>
        <query>index=test_*  appname=* | rename kubernetes.namespace_name as env_name | rex field=host "ab_bc-[^-]*-(?P<env_name>[^-]*)-" | sort env_name | dedup env_name | stats count by env_name</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
    </input>

There are 25 events from the above query and they are like this

env_name    count
mlcd1   1
mlcd2   1
mlct1   1
mlct2   1
np1 1
np10    1
np11    1
np12    1
np13    1
np14    1
np15    1
np16    1
np17    1
np18    1
np19    1
np2 1
np20    1
np3 1
np4 1
np5 1
np6 1
np7 1
np8 1
np9 1
prod    1

I am only seeing top 5 values + prod in dropdown. What's wrong with this?

0 Karma

somesoni2
Revered Legend

Your dropdown code seems incorrect per your query. For displaying data to dropdown, you've configured following:-

   <fieldForLabel>Environment</fieldForLabel>
   <fieldForValue>env_name</fieldForValue>

Values of both attribute points to a field in the search result (search result field specified in fieldForLabel will be shown as labels in dropdown and field specified in fieldForValue will be used as value for corresponding label). You search query has just env_name and count as field, so fieldForLabel is wrong here. Try this

   <fieldForLabel>env_name</fieldForLabel>
   <fieldForValue>env_name</fieldForValue>

gcusello
SplunkTrust
SplunkTrust

Hi dyapasrikanth,
I'm not sure to understand your need: your search has al the results you listed, but in th dropdown it displays only five values?

Anyway, at first in a dropdown list you can diplay only one field, so in your case your search should be:

index=test_*  appname=* 
| rename kubernetes.namespace_name as env_name 
| rex field=host "ab_bc-[^-]*-(?P<env_name>[^-]*)-" 
| stats count by env_name
| sort env_name 
| table env_name

If you want also the value of count, you have to modify your search in this way

index=test_*  appname=* 
| rename kubernetes.namespace_name as env_name 
| rex field=host "ab_bc-[^-]*-(?P<env_name>[^-]*)-" 
| stats count by env_name
| sort env_name 
| eval env_name=env_name." ".count
| table env_name

Ciao.
Giuseppe

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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...