Splunk Search

How to filter my search results to only return events where a certain message occurred within 5 seconds of each other?

jpkeeton
New Member

This can't be answered by limiting the time range searched.

Repro:
- I set my search terms and date range.
- I get back plenty of results, but
- I need to limit results only to times where a certain message is logged with 5 or so seconds of another

example
04-15-16 05:15:00 - neededMessage
04-17-16 22:00:15 - neededMessage
04-17-16 22:04:01 - neededMessage

04-19-16 04:02:33 - neededMessage

So there are results, but I only want results returned that are within a few seconds of each other, like rows 2 and 3 above.

Tags (3)
0 Karma

dolivasoh
Contributor

Transaction is your friend.

| transaction startswith=neededMessage1 endswith=neededmessage2 | where duration <=5
0 Karma

somesoni2
Revered Legend

Throw in the maxspan=5s OR 5m in transaction command to further limit the number of transactions.

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