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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...