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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...