Splunk Search

Best way to find destination IPs that become source IPs?

jbreeves
New Member

Hi, 

I'm attempting to build a query to find destination IP addresses that became source IPs for traffic in a 5min window.  What is the best way to do this? Given that it's IDS data, I don't think a join with subsearch would be good because of the 10,000 record limitation and the map function takes forever just looking at 15mins worth of data. 

Any ideas or help is greatly appreciated!

Labels (1)
Tags (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

You have to untable your results.

<your_search> 
| fields _time src dst
| untable _time end ip
| sort 0 _time
| streamstats values(end) as end by ip time_window=5m
| search end=s end=d

There is one caveat though. Even though the time window is expressed with a time value it still has to fit within the global max_stream_window limit (10k rows by default).

0 Karma

PickleRick
SplunkTrust
SplunkTrust

But you can get around this limitation.

After the sort do

| streamstats latest_time(eval(if(end="d",1,null()))) as lastd by ip
| where end="s" and _time-lastd<300

I'm not sure if I didn't sort the wrong way or did the time comparison the wrong way around. But you should get the idea.

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @jbreeves,

You can try with a subsearch using stats to limit results like below;

index=ids 
    [ index=ids 
    | stats count by dest_ip 
    | fields dest_ip 
    | rename dest_ip as src_ip ] 
| stats count by src_ip
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...