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!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...