Dashboards & Visualizations

How to generate a drop-down form based on values from a lookup table?

deepthi5
Path Finder

Hi all ,

I have a search which uses a lookup datacentre.csv that has fields country start, hour, end hour, and I want to generate a drop-down list in my dashboard based on the country names present in the lookup file.

Can some one help please?

source="C:\\Budapest Router1full.csv" host="SEZ00VVM-153"   sourcetype="csv" date_wday!=saturday AND date_wday!=sunday| rex field=source "(?<country>.*?)$"| lookup datacentre.csv country OUTPUT start_hour end_hour receivebandwidth |where date_hour>=start_hour AND date_hour<= end_hour | eval Intraffic=IN/1048576 |timechart span=1h perc95(Intraffic) AS 95thPercentile ,values(receivebandwidth) as MAXIN-Bandwidth
0 Karma

somesoni2
Revered Legend

You can have following for your dropdown code in your dashboard.

<input type="dropdown" token="country" searchWhenChanged="true">
      <label>Year</label>
      <choice value="*">All</choice>
      <search>
        <query>| lookup datacentre.csv | stats count by country</query>
      </search>
      <fieldForLabel>country</fieldForLabel>
      <fieldForValue>country</fieldForValue>
      <default>*</default>
    </input>

Now change your search like this to use the token

source="C:\\Budapest Router1full.csv" host="SEZ00VVM-153"   sourcetype="csv" date_wday!=saturday AND date_wday!=sunday| rex field=source "(?<country>.*?)$" | search country="$country$"| lookup datacentre.csv country OUTPUT start_hour end_hour receivebandwidth |where date_hour>=start_hour AND date_hour<= end_hour | eval Intraffic=IN/1048576 |timechart span=1h perc95(Intraffic) AS 95thPercentile ,values(receivebandwidth) as MAXIN-Bandwidth
0 Karma

jeffland
SplunkTrust
SplunkTrust

Simply supply a search with the lookup as the search that powers the "Dynamic options" for the dropdown and select the fields for label and value appropriately.

I am sure the markup messed up your search, please post it as code and not as raw text (with the little icon above the text field for example).

0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

  Ready to master Kubernetes and cloud monitoring like the pros?Join Splunk’s Growth Engineering team for an ...

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...