Getting Data In

How to populate second dropdown(source) list based on the first dropdown(host) selection?

navd
New Member

Here is my sample code that I am using

<form>
   <label>raw data</label>
    <fieldset submitButton="true" autoRun="true">
<input type="dropdown" token="host" searchWhenChanged="true">
  <label>Select Host Name</label>
  <choice value="*">ALL</choice>
  <fieldForLabel>host</fieldForLabel>
  <fieldForValue>host</fieldForValue>
  <search>
    <query>index=abcd |dedup host</query>
    <earliest>-24h@h</earliest>
    <latest>now</latest>
  </search>
</input>
<input type="time" token="time_range" searchWhenChanged="true">
  <label>Select Time Range</label>
  <default>
    <earliest>-24h@h</earliest>
    <latest>now</latest>
  </default>
</input>
<input type="dropdown" token="source" searchWhenChanged="true">
  <label>Select Source</label>
  <choice value="*">ALL</choice>
  <fieldForLabel>source</fieldForLabel>
  <fieldForValue>source</fieldForValue>
  <search>
    <query>index=abcd |dedup source</query>
    <earliest>-24h@h</earliest>
    <latest>now</latest>
  </search>
</input>
  </fieldset>
  <row>
    <panel>
     <event>
    <search>
      <query>index="abcd" host=$host$</query>
      <earliest>$time_range.earliest$</earliest>
      <latest>$time_range.latest$</latest>
    </search>
    <option name="list.drilldown">full</option>
    <option name="refresh.display">progressbar</option>
  </event>
  </panel>
  </row>
</form>
0 Karma
1 Solution

pradeepkumarg
Influencer

Update your search for source and include host token


index=abcd host=$host$ |dedup source

View solution in original post

0 Karma

pradeepkumarg
Influencer

Update your search for source and include host token


index=abcd host=$host$ |dedup source

0 Karma

navd
New Member

I updated the search for source and I could see source based on host selected, but when I choose any option from the source I couldn,t see the results/events based on the source selected

0 Karma

pradeepkumarg
Influencer

because you are not using source filter in your final search

add source=$source$ in your final search

0 Karma

navd
New Member

got it thanks

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Unmerging HTML Tables

[Puzzles] Solve, Learn, Repeat: Unmerging HTML TablesFor a previous puzzle, I needed some sample data, and ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...