Splunk Search

Find searches that reference indexes that no longer exist

dashe
Engager

Hi,

I'm trying to clean up an old splunk cloud instance. one thought that occurred to me is find scheduled searches that reference indexes that don't exist anymore, they have long been cleaned up and deleted but scheduled searches may still exist against these deleted indexes.

I tried looking in internal indexes but don't see any sort of warning messages for index does not exist.

Does anyone know if such a warning message shows up that I can then use to deactivate these searches?

thanks in advance

Dave

Labels (1)
0 Karma

sainag_splunk
Splunk Employee
Splunk Employee

 

I think there is no easy way because, as @richgalloway  mentioned, there is no warning when a search tries to use an index that doesn't exist. Even if you choose result_count=0, you will get a lot of false positives. The best way is to run a search against the saved searches and validate with your existing indexes.

The most reliable approach is the manual two-step method:

Step 1: Get scheduled searches and their referenced indexes

 
 
| rest /services/saved/searches | search disabled=0 is_scheduled=1 | rex field=search "index\s*=\s*(?<referenced_index>[^\s\|]+)" | stats values(title) as searches by referenced_index

Step 2: Get your current indexes

 
 
| rest /services/data/indexes | fields title 



If this Helps, Please Upvote.

If this helps, Upvote!!!!
Together we make the Splunk Community stronger 

richgalloway
SplunkTrust
SplunkTrust

@sainag_splunk's answer is correct, but be aware that not all searches specify an index name and those that do might do so using a wildcard.  This is a Hard Problem addressed in the .conf24 talk "Maximizing Splunk Core: Analyzing Splunk Searches Using Audittrail and Native Splunk Telemetry", which offers some ways to get the indexes used by a search.

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

richgalloway
SplunkTrust
SplunkTrust

There is no warning when a search tries to use an index that doesn't exist.

---
If this reply helps you, Karma would be appreciated.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...