Splunk Search

comparing values returned by two separate searches with a threshold

akhan92394
Explorer

I have a search which looks for VA scanning activity from firewalls threat logs, I am attempting to have an alert trigger if activity is seen going back to the source IP. I was able to come up with something that appears to work. My logic would be that I want to then search the firewall traffic logs to see if any of the destination IP's match the source IP's from the previous search.

Would this be the most efficient way of going about this? Query Below.

index=X sourcetype="pan:threat" " (severity=critical OR severity=high OR severity=medium)
| stats dc(signature) as Attacks by src_ip
| where Attacks > 10
| fields src_ip | join src_ip [search index=X sourcetype="pan:traffic" | fields dest_ip] | where src_ip = dest_ip

0 Karma
1 Solution

mayurr98
Super Champion

hey you can try something like this

index=X sourcetype="pan:threat"  (severity=critical OR severity=high OR severity=medium) 
| stats dc(signature) as Attacks by src_ip 
| where Attacks > 10 
| table src_ip | join src_ip [search index=X sourcetype="pan:traffic" | dedup dest_ip | table dest_ip | rename dest_ip as src_ip]

let me know if this helps!

View solution in original post

0 Karma

mayurr98
Super Champion

hey you can try something like this

index=X sourcetype="pan:threat"  (severity=critical OR severity=high OR severity=medium) 
| stats dc(signature) as Attacks by src_ip 
| where Attacks > 10 
| table src_ip | join src_ip [search index=X sourcetype="pan:traffic" | dedup dest_ip | table dest_ip | rename dest_ip as src_ip]

let me know if this helps!

0 Karma

akhan92394
Explorer

Thank you for the response,

Would you mind clarifying where the comparison is done in the query to check if the Dest IP matches the source IP's from the first search. Just trying to get a better understanding of your logic.

much appreciated.

0 Karma

mayurr98
Super Champion

so after join you are getting the only column which is src_ip which are actually dest_ip's which are matching src_ips.
so what I have done has I created a table of src_ip's having attacks>10. so you have a table which has src_ips.
then I created another table from sourcetype=pan:traffic. got a table of dest_ips .I renamed those ips as src_ip because I have to match this with the previous table so that is why join src_ip. so whatever output you are getting is basically matching ips between src_ip and dest_ip.

I hope you understand this

sorry for my english!

0 Karma

akhan92394
Explorer

Understood perfectly. Thank you for you explanation. I appreciate it.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...