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!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...