Developing Dashboards, Views, and Apps for Splunk Web

 


How to use a lookup with your view

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

How to use a lookup with your view

There are a lot of helpful ways to use Splunk's lookup feature with your views. If you're not familiar with building lookup tables in Splunk, check out the Look up topic in the Knowledge Manager Manual.

Here are a few examples of using lookups in views. There are many different ways to use lookups, but hopefully these examples will give you some idea of the possibilities.

Lookups and dropdowns

This example shows a snippet from a dashboard that has two dropdown, 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 whole snippet that renders 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>                    
...

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!