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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...