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!

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...