Developing Dashboards, Views, and Apps for Splunk Web

 


How to add drop-downs

This documentation does not apply to the most recent version of Splunk. Click here for the latest version.

How to add drop-downs

Create a form search with dynamic drop-downs. This means you can specify a search to autopopulate drop-down choices. Anyone who uses your form can pick between the radio buttons to populate the final search.

Start your drop-down form

Take the form search from step 1:

<form>
 <label>Username</label>
 <searchTemplate>sourcetype=logins $username$</searchTemplate>  
 <fieldset>
  <input type="text" token="username" />
 </fieldset>
    
 <row>
  <event>
    <option name="count">100</option>
   </event>
  </row>
</form>

Now, change the <input type="text"> tag to dropdown and add a populatingSearch to generate the options for the drop-down:

<input type="dropdown" token="username">
   <label>Select Name</label>
   <populatingSearch fieldForValue="suser" fieldForLabel="suser"><![CDATA[sourcetype=p4change | rex "user=(?<suser>\w+)@"
      | stats count by suser]]></populatingSearch>
</input>

Here's what the final product looks like:

<input type="dropdown" token="username">
   <label>Select Name</label>
   <populatingSearch fieldForValue="suser" fieldForLabel="suser"><![CDATA[sourcetype=p4change | rex "user=(?<suser>\w+)@"
      | stats count by suser]]></populatingSearch>
   <default>nagrin</default>
   <choice value="*">Any</choice>
</input>

  <row>
   <table>
    <title>Users</title>
     <option name="showPager">true</option>
    </table>
  </row>

Configuration options

There are more configuration options you can set on <input type=dropdown>. For example, you can add a label to appear next to the drop-down, or specify a search to populate the drop-down, etc. None of these options are required, but they do make the drop-down more useful.

Here are all your options for configuration:

This documentation applies to the following versions of Splunk: 4.1 , 4.1.1 , 4.1.2 , 4.1.3 , 4.1.4 , 4.1.5 , 4.1.6 , 4.1.7 , 4.1.8 View the Article History for its revisions.


You must be logged into splunk.com in order to post comments. Log in now.

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!