Splunk Enterprise

Can asterisks (*) be used in search names within the savedsearches.conf?

Sharzi
Explorer

Hi,

I have multiple searches that follow a naming convention like "Server1_Monitoring", "Server2_Monitoring", and so on. I used an asterisk in the search name stanza to match all of them in the savedsearches.conf file, like:

[Server*_Monitoring]

dispatch.ttl=3p

I restarted the search head after the change, but it didn't work. Is there any way to avoid listing all the searches explicitly in savedsearches.conf?

Thank you!

Labels (2)
Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The savedsearches.conf file defines your searches so for Splunk to know what each search is called, it must be explicitly named in the stanza.  Wildcards won't work because the "*" represents a near-infinite set of search names.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The savedsearches.conf file defines your searches so for Splunk to know what each search is called, it must be explicitly named in the stanza.  Wildcards won't work because the "*" represents a near-infinite set of search names.

---
If this reply helps you, Karma would be appreciated.

FritzWittwer
Path Finder

as you have to be explicit whit stanza names, you could put all this saved searches into a dedicated app, and the set the ttl in the default stanza [default]  for all searches in this app.

 

0 Karma

Sharzi
Explorer

Thank you @richgalloway for your reply!

Since all of the monitoring searches are under my username, would you know a solution to set dispatch.ttl based on the username, not the search names? so all searches under my username would have dispatch.ttl=3p .

richgalloway
SplunkTrust
SplunkTrust

Write a script that uses the REST API to pull a list of saved searches, filters on your name, then updates them with the new TTL.  See https://docs.splunk.com/Documentation/Splunk/9.2.0/RESTREF/RESTsearch#saved.2Fsearches

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...