Developing Dashboards, Views, and Apps for Splunk Web

 


Use lookups with a view

NOTE - Splunk version 4.x reached its End of Life on October 1, 2013. Please see the migration information.

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

Use lookups with a view

There are many ways to use Splunk's lookup feature with views. If you're not familiar with building lookup tables in Splunk, refer to the "Look up fields from external data sources" topic in the Knowledge Manager Manual.

Here are a few examples of using lookups in views. There are many different ways to use lookups – these examples give you an idea of the possibilities.

Lookups and dropdowns

This example shows a dashboard that has two dropdowns, one to select country and one to select a city in that country. The city dropdown is populated by a lookup called "citylookup" that dynamically populates the dropdown based on the country selection. The part of the XML that calls the lookup is within the SearchSelectLister module.

. . .
<module name="SearchSelectLister">
  <param name="settingToCreate">pref</param>
  <param name="label">City</param>
  <param name="applyOuterIntentionsToInternalSearch">True</param>
  <param name="search">| inputlookup myLookup2</param>
  <param name="searchFieldsToDisplay">
    <list>
     <param name="label">city</param>
     <param name="value">city</param>
    </list>
  </param>
. . .


Here is the code for the two dropdowns:

. . .
<module name="StaticSelect">
  <param name="settingToCreate">area</param>
  <param name="label">Country</param>
  
  <param name="staticFieldsToDisplay">
    <list>
      <param name="label">USA</param>
      <param name="value">USA</param>
    </list>
    <list>
      <param name="label">Japan</param>
      <param name="value">Japan</param>
    </list>
    <list>
      <param name="label">China</param>
      <param name="value">China</param>
    </list>
    <list>
      <param name="label">Germany</param>
      <param name="value">Germany</param>
    </list>
  </param>
  
    <module name="ConvertToIntention">
      <param name="settingToConvert">area</param>
      <param name="intention">
        <param name="name">addterm</param>
        <param name="arg">
          <param name="area">$target$</param>
        </param>
      </param>

      <module name="SearchSelectLister">
        <param name="settingToCreate">pref</param>
        <param name="label">City</param>
        <param name="applyOuterIntentionsToInternalSearch">True</param>
        <param name="search">| inputlookup citylookup</param>
        <param name="searchFieldsToDisplay">
          <list>
            <param name="label">city</param>
            <param name="value">city</param>
          </list>
        </param>
        
         <module name="ConvertToIntention">
           <param name="settingToConvert">pref</param>
           <param name="intention">
             <param name="name">addterm</param>
             <param name="arg">
               <param name="pref">$target$</param>
             </param>
           </param>
         </module> <!-- End ConvertToIntention -->
         . . .
      </module> <!-- End SearchSelectLister -->
    </module> <!-- End ConvertToIntention -->
</module> <!-- End StaticSelect -->
. . .

This documentation applies to the following versions of Splunk: 4.3 , 4.3.1 , 4.3.2 , 4.3.3 , 4.3.4 , 4.3.5 , 4.3.6 , 4.3.7 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!