Reporting

Query to retrieve Saved Search String

rmorlen
Splunk Employee
Splunk Employee

I am trying to get an export of all of our saved searches so that we can review them. If I used the search "source=*scheduler.log* | eval search_time=strftime(scheduled_time,"%H:%M") | dedup savedsearch_name | table user search_time savedsearch_name" I get a nice table but what I would like to see is the actual search string tied to each saved search. We can then export the information so we can review the saved searches and try to optimize them.

(In case you are asking why we want to do this we have about 600 saved searches and about 21,000 scheduled searches running per day.)

Any suggestions on how I might get this information?

1 Solution

Ayn
Legend

You can get this information through the wonderful rest command that was added in Splunk recently:

| rest /services/saved/searches

This will query the REST endpoint /services/saved/searches and present the output as search results.

View solution in original post

rmorlen
Splunk Employee
Splunk Employee

This works really well: "| rest /services/saved/searches | dedup search | table title search"

rmorlen
Splunk Employee
Splunk Employee

Ok. Thanks for the help. We have a dev/test instance of Splunk running 4.3.2 so I can just export all the users directories and bring them up in our dev instance and the search above should get us what we need.

Thank you.

0 Karma

_d_
Splunk Employee
Splunk Employee

| rest /services/saved/searches | table search

0 Karma

Ayn
Legend

You can get this information through the wonderful rest command that was added in Splunk recently:

| rest /services/saved/searches

This will query the REST endpoint /services/saved/searches and present the output as search results.

rmorlen
Splunk Employee
Splunk Employee

Actually this doesn't seem to be doing what I need. It appears that it only returns results for "author noboby" and my username. Not saved searches for all users. ("| rest /services/saved/searches | sort title | table author title search")

0 Karma

rmorlen
Splunk Employee
Splunk Employee

Ah. We are running 4.2.5. The rest command doesn't work.

0 Karma
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 ...