Splunk Search

Populate dropdown form field values from a file

sranga
Path Finder

Hi

I was wondering if its possible to populate the values for a dropdown field of a form from a file through a lookup command.

The current setup uses the populatingSearch feature and it is very slow. I don't want to add all of the values to the form field as <choice> tags.

Thanks for your help.

Ranga

Tags (2)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

You can use the | inputlookup command to get the contents of a lookup file into your populatingSearch

View solution in original post

sideview
SplunkTrust
SplunkTrust

Yes this is possible and its a great way to do it.

Assuming you're working with a simplified XML view, (ie where your outer tag is <form>), its extremely easy. It's really just a matter of using the inputlookup command in the element.

See here for general discussion of how to configure a pulldown that gets its values from any search. and just picture the search in question starting with the inputlookup command. http://www.splunk.com/base/Documentation/latest/Developer/AddDropDowns

As always, remember to test out the search commands in the search UI to make sure you understand what it's doing and that the fields are coming out right.

Also, if you're using the advanced XML already, the developer manual actually has an example written up about this topic specifically:

http://docs.splunk.com/Documentation/Splunk/5.0/AdvancedDev/LookupsAndViews

ChrisG
Splunk Employee
Splunk Employee

gkanapathy
Splunk Employee
Splunk Employee

You can use the | inputlookup command to get the contents of a lookup file into your populatingSearch

Johnvey
Contributor

Generally, yes. The inputlookup, at its simplest, just reads lines in from a CSV file so it's about as fast as it gets. Savedsearch can be just as fast if there is a previously scheduled job artifact available -- otherwise a new search will be kicked off.

0 Karma

sranga
Path Finder

Thanks. Is this faster than a | savedsearch?

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...