Reporting

Saved Searches and Passing Parameters

tmurray3
Path Finder

I have a saved search which I would like to pass a "host=XXX" parameter to. Can this be done? If so, do I have to modify the saved search? Can you point me to some examples?

Thanks in advance for your assistance.

Tags (1)

dshroff
Engager

Just to be more clear.

Search should be saved as
saved_search_name
index=xyz KEY_1=123 KEY_2=456 host=$host$

When using in a dashboard it should be
| savedsearch saved_search_name host=$host$

0 Karma

christophe_sahu
Explorer

How can we set these parameters in a dashboard panel ?
MySavedSearch host=XYZ gives

Configuration error - we were not able to find a saved search called "MySavedSearch host=XYZ".

0 Karma

abhayneilam
Contributor

use the below

| savedsearch "MySavedSearch" host="XYZ

0 Karma

Ledion_Bitincka
Splunk Employee
Splunk Employee

yes you can

(1) create a savedsearch whose search looks like this (use $variable$):

search = .... host=$host$ ...

(2) invoke this from the search as follows

| savedsearch MySavedSearch host=XYZ

nick405060
Motivator

This does not work if your savedsearch evals something to the passed parameter, and then you want that to be included in the email. In this case you must include strings in the savedsearch eval statement eval test="$passed_param$" NOT eval test=$passed_param$. If you aren't evaling then this solution works as described without the quotes.

0 Karma

camillak
Path Finder

Is anyone aware of a way to iterate over several variables as a part of a scheduled search?

I would like to do something like this:

search = sourcetype=mysourcetype locale=$locale$
| outputlookup mylookup$locale$.csv

This works to run manually from the search bar - any guidance on how to do this automatically? Dealing with an indeterminate number of locales.

0 Karma

camillak
Path Finder

Ultimately used 2 saved searches, 1 with $locale$ and then a second search with | makeresults and | map:
| makeresults | eval locales = "ja,de,en"
| eval locale = split(locales,",")
| mvexpand locale
| map saved_search_name
The first one is unscheduled, the second is scheduled.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...