Splunk Dev

How to update a dropdown list from another dropdown list

jip31
Motivator

Hi

In my dashboard I use a first dropdown list with static values

These values make reference to the SITE fields I use in my different reports with the lookup below :

 

    | lookup TOTO.csv HOSTNAME as host output SITE 

 

 

Now, I would be able to update a second dropdown list from the first need

It means that when I select the SITE field in the first drilldown, I would like to display in the second dropdown list  all the host corresponding to the SITE selected in the first dropdown list 

Could you help me please?

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@jip31,

Use the token from first dropdown in the second drop down by using a dynamic search.

Please find a run anywhere example

<form>
  <label>Drop Down</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="site">
      <label>Site</label>
      <choice value="site1">Site1</choice>
      <choice value="site2">Site2</choice>
      <choice value="site3">Site3</choice>
      <default>site1</default>
      <initialValue>site1</initialValue>
    </input>
    <input type="dropdown" token="host">
      <label>Host</label>
      <fieldForLabel>hosts</fieldForLabel>
      <fieldForValue>hosts</fieldForValue>
      <search>
        <query>|makeresults|eval site="site1 site1 site2 site2 site3 site3"|makemv site|mvexpand site
|appendcols [|makeresults | eval hosts="host1 host2 host3 host4 host5 host6"|makemv hosts|mvexpand hosts]
|where site="$site$"
|stats count by hosts|fields hosts</query>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </search>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults|eval site="site1 site1 site2 site2 site3 site3"|makemv site|mvexpand site
|appendcols [|makeresults | eval hosts="host1 host2 host3 host4 host5 host6"|makemv hosts|mvexpand hosts]
|where site="$site$"</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</form>

Table is just a display of second dropdown search

---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

renjith_nair
Legend

@jip31,

Use the token from first dropdown in the second drop down by using a dynamic search.

Please find a run anywhere example

<form>
  <label>Drop Down</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="site">
      <label>Site</label>
      <choice value="site1">Site1</choice>
      <choice value="site2">Site2</choice>
      <choice value="site3">Site3</choice>
      <default>site1</default>
      <initialValue>site1</initialValue>
    </input>
    <input type="dropdown" token="host">
      <label>Host</label>
      <fieldForLabel>hosts</fieldForLabel>
      <fieldForValue>hosts</fieldForValue>
      <search>
        <query>|makeresults|eval site="site1 site1 site2 site2 site3 site3"|makemv site|mvexpand site
|appendcols [|makeresults | eval hosts="host1 host2 host3 host4 host5 host6"|makemv hosts|mvexpand hosts]
|where site="$site$"
|stats count by hosts|fields hosts</query>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </search>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults|eval site="site1 site1 site2 site2 site3 site3"|makemv site|mvexpand site
|appendcols [|makeresults | eval hosts="host1 host2 host3 host4 host5 host6"|makemv hosts|mvexpand hosts]
|where site="$site$"</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</form>

Table is just a display of second dropdown search

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

jip31
Motivator

thanks renjith

Tags (1)
0 Karma
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!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...