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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...