Splunk Search

Dropdown values from lookup

splunkn
Communicator

Im having a lookup table which consist of applicationid,applicationname,hosts. For single application I have many hosts.
So I tried with the below
appid,appname,host
APP123,ABCDE,host1;host2;host3
APP234,CDDSD,host4;host5;host6

I want to have two dropdowns in my form. One for application another one for host.
I want to populate the hosts one by one in dropdown corresponding to application. I tried with the delimiter ";".
However no luck. Is there any possible solution or should I go with one by one for each host in lookup 😞

    <label>ABC</label>
    <fieldset autoRun="false">
            <input type="time">
                    <label>Select Time</label>
                    <default>Last 15 minutes</default>
            </input>

            <input type="dropdown" token="appid">
                    <label>Select appid</label>
                    <populatingSearch fieldForValue="appid" fieldForLabel="applabel">
                            <![CDATA[ | inputlookup abc.csv |dedup appid,appname | sort appid,appname | eval applabel=appid + "-" + appname ]]>
                    </populatingSearch>
                    <default>*</default>
  <choice value="*">All</choice>
            </input>

            <input type="dropdown" token="host">
                    <label>Select host</label>
                    <populatingSearch fieldForValue="host" fieldForLabel="host">
                            <![CDATA[ | inputlookup abc.csv  | search appid=$appid$ | makemv delim=";" host | fields host ]]>
                    </populatingSearch>
                    <default>*</default>
  <choice value="*">All</choice>
            </input>
    </fieldset>
Tags (2)
0 Karma

vasanthmss
Motivator

Try this,

Populate Appid search,

| inputlookup abc.csv |dedup appid,appname | sort appid,appname | eval applabel=appid + "-" + appname

Populate Host based on Appid search, [ Assuming you have ";" as your delimiter in host field ]

| inputlookup abc.csv  | eval host=split(host,";") | mvexpand host | search appid=$appid$ | stats count by host  | fields host

Hope this will help you,

Cheers!

V
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...