Splunk Search

metadata (source age ) search over search string in sources

vadsys
Engager

Hello I am trying to create a search query like so:

search for specific terms (searchterm#1 AND NOT completed successfully) in a list of sources over the last 4 hours (earliest=-4h). For each source that's returned, complete a metadata search to find if the lastTime (most recent event update) for any source is more than a set threshold (say 300 seconds) and return the result as an array of "source:lastUpdate"

Is the above possible? (I think I can get each one individually, by not together)

Thanks in advance !

Tags (3)
0 Karma

lguinn2
Legend

Try this

(searchterm#1 AND NOT completed successfully) AND (source=source1 OR source=source2) earliest=-4h
| join source [ | metadata type=sources ]
| where now() - lastTime > (300 * 1000)
| eval lastUpdate = stftime(lastTime,"%X %x")
| table source lastUpdate

If you have a lot of sources that you want to check, you might put them in a lookup table. I just listed two in the example.

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