Splunk Search

How to join 2 searches based on time range?

Mattjj
Explorer

Hi all,

We have events in a single index for flows into and out of a gateway, I’m trying to link an incoming event with the outgoing:

search 1:

index=vpc | where src=<gateway_out_ip> | table starttime, endtime, src, dest

search 2:

index=vpc | where dest=<gateway_in_ip> AND src=<server_ip> | table starttime, endtime, src, dest

 

The idea is to join search 1 to search 2 where the starttimes are within 3 seconds of each other, so I can see the dest in search 1 for the <server_ip> In search 2.  I tried using transaction but there aren’t any common data between the two searches.  I only want to include events from search 1 that have a corresponding (within 3 seconds) event in search 2.

Can anyone advise on the best way to do this?

 

Thanks 

Labels (2)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

Try transaction with startswith, endwith, maxspan.  Something like

index=vpc (src=<gateway_out_ip> OR dest=<gateway_in_ip> AND src=<server_ip>)
| transaction startswith=eval(src="<gateway_out_ip>") endswith=eval(dest="<gateway_in_ip>" AND src="<server_ip>") maxspan=3s
| table starttime, endtime, src, dest

 

View solution in original post

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Try transaction with startswith, endwith, maxspan.  Something like

index=vpc (src=<gateway_out_ip> OR dest=<gateway_in_ip> AND src=<server_ip>)
| transaction startswith=eval(src="<gateway_out_ip>") endswith=eval(dest="<gateway_in_ip>" AND src="<server_ip>") maxspan=3s
| table starttime, endtime, src, dest

 

0 Karma

Mattjj
Explorer

That works perfectly, thank you!

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...