Splunk® Enterprise

Developing Dashboards, Views, and Apps for Splunk Web

Download manual as PDF

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.
Download topic as PDF

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 -->
. . .
PREVIOUS
Lister modules
  NEXT
Use one search for a whole dashboard

This documentation applies to the following versions of Splunk® Enterprise: 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.


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

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

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters