Dashboards & Visualizations

passing variables from a dropdown into saved searches.

DTERM
Contributor

There have been several posts about this, but I did not find any that address this requirement.

I need to modify a form to include a drop down list. I've implemented a drop down list that pulls information from a lookup table. Now I need to pass these variables to predefined searches I've implemented in the view. How do I do that? I've included the code with some comments below.

Thanks in advance...

<form class="formsearch">


index=MyApp host=$host

|inputlookup hosts.csv | fields + VHost Any Last 15 minutes



Daily Summary






ServiceName
Service Names
pie
all


ProductName
Product Name
bar
all




TopHosts
Top Hosts
pie
all


TopHosts
Top Hosts
bar
all




TopSeverity
Top Severities
pie
all


TopSeverity
Top Severities
bar
all




All_Shifts
Shift Status
line
all

Tags (1)
0 Karma

lguinn2
Legend

In your searchTemplate, host=$host won't work. It needs to be

host=$host$ 

and better if you put "" around it, in case you get a weird value in the variable ...

host="$host"

You can't pass variables into saved searches. However, you could use macros.
But I don't know that what you are trying to do is really going to work anyway - try it, and ask more questions.

I would suggest that you download the Splunkbase app Splunk UI Examples for 4.1+ to see how some of this can be done. It's a year old, but the examples are still excellent, especially for advanced dashboards. You should probably also look at Form Searches in the Developing... Manual, especially this section: Step 3 Form Output

Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...