Reporting

Is it possible to determine the last time a saved search was executed?

kbecker
Communicator

I am looking to audit the non-scheduled saved searches that users have created, is there a way to obtain the last run time of each saved search?

Tags (1)
0 Karma

araitz
Splunk Employee
Splunk Employee
index="_internal" (sourcetype="splunk_web_service" view "loading saved search") 
OR (sourcetype=splunkd_access "GET /servicesNS/" "/search/saved/searches") 
| rex "loading saved search \"(?<saved_search>[^\"]+)" 
| eval uri_decode = urldecode(uri) 
| rex field=uri_decode "saved\/searches\/(?<saved_search>[^\$]+)$" 
| search saved_search=* NOT saved_search="_new" 
| transaction saved_search maxspan=2s
| search sourcetype="splunk_web_service" AND sourcetype="splunkd_access" 
| stats first(user) as user last(_time) as last_run_time by saved_search 
| fieldformat last_run_time=strftime(last_run_time, "%m/%d/%Y %H:%M:%S")

netwrkr
Communicator

I know this query can be written better but it works 😉

audit_searchlocal | audit_rexsearch | search search_id!=scheduler_* | search search=search* search!=*_internal* search!=*_audit* | search NOT audit_search* | search NOT audittrail

HTH

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...