Splunk Search

drop down list population with extracted search fields

santoshbala
Engager

I'm trying to populate my drop down list with extracted fields of a search, most examples I've seen on splunkbase explain it quite well, but I don't think I'm getting the syntax right, how do I set the 'fields' as the token to pass to my populating search? I currently have this:

<! -- default search to assign tokens --->



index=main host=gridnames | fields gridnames | dedup gridnames <!- set $grid$ here: HOW?>









<![CDATA[index="main" host=gridnames| fields grid | dedup grid]]>



default



I know I'm not setting $grid$ in the searchtemplate, but how do I do it for the field gridnames?

0 Karma
1 Solution

sowings
Splunk Employee
Splunk Employee

The searchtemplate element is for the main search you want to run in the dashboard. The search to get the list of values to display in the dropdown is the body of the populating search element.


<searchtemplate>big_search_here grid=$grid$</searchtemplate>
<fieldset>
<input type="dropdown" token="grid">
<populatingSearch fieldForLabel="gridnames" fieldforValue="gridnames"> index=main host=gridnames | fields gridnames | dedup gridnames</populatingSearch>
</input>
</fieldset>

View solution in original post

sowings
Splunk Employee
Splunk Employee

The searchtemplate element is for the main search you want to run in the dashboard. The search to get the list of values to display in the dropdown is the body of the populating search element.


<searchtemplate>big_search_here grid=$grid$</searchtemplate>
<fieldset>
<input type="dropdown" token="grid">
<populatingSearch fieldForLabel="gridnames" fieldforValue="gridnames"> index=main host=gridnames | fields gridnames | dedup gridnames</populatingSearch>
</input>
</fieldset>

santoshbala
Engager

Brilliant! Works a treat! thanks a lot!

For anyone else looking:

<searchTemplate> 

index=main host=gridnames | fields $grid$ | dedup $grid$

<fieldset> 




<![CDATA[index="main" host=gridnames| fields gridnames | dedup gridnames]]>

testabooga

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...