Splunk Search

correlate multiple destination fields based on single source field.

jpena323
Explorer

Hi guys,

Would really appreciate your help looking for a splunk search to do some reporting/alerting for me based on my firewall logs... specifically having issues with correlating a single source field (such as IP address or hostname) to multiple other field counts (such as port or username).

I know there has to be a way to accomplish this but i've tried joins/appendpipe/and others with no luck...

Example of what I'm trying to accomplish:
Top list of source IP addresses hitting deny ACLs to multiple ports and total hits (such as someone scanning our network).

Source_IP - Source_Country - Total_Denies - Total_Port_Attempted
1.2.3.4 - - - - - - - - China - - - - - - - - 1678 - - - - - - - - - 64
9.8.7.6 - - - - - - - - Ukraine - - - - - - -1204 - - - - - - - - - 76
4.2.3.2 - - - - - - - - Netherlands - - - - 804 - - - - - - - - - - 4

Here is what I got so far:
sourcetype="juniper" reason="policy deny" src_zone="UNTRUST" | lookup geoip clientip as src_ip | stats dc(dest_port) as Total_Port_Attempted by src_ip,client_country

Problem here is that I lose the total count 😞 ...I've tried to get creative with the stats command but keep getting repeated group-by field error messages. Would be nice to even throw in a Total_DestIP_Attempted...

Any help is much appreciated!
Thanks!

P.S. Here is an example log entry:
*Apr 2 12:29:02 labsrx2 1 [src-ip="11.67.18.25" src-port="57900" dest-ip="11.21.8.188" dest-port="44256" type="TCP" policy="GLOBAL_DENY_LOG(global)" src-zone="UNTRUST" dest-zone="UNTRUST" reason="policy deny"]

1 Solution

somesoni2
Revered Legend

How about this

sourcetype="juniper" reason="policy deny" src_zone="UNTRUST" | lookup geoip clientip as src_ip | stats dc(dest_port) as Total_Port_Attempted count as Tota_Denies dc(des_ip) as Total_DestIP_Attempted by src_ip,client_country

View solution in original post

masonmorales
Influencer
sourcetype="juniper" reason="policy deny" src_zone="UNTRUST" | lookup geoip clientip as src_ip | stats count as Total_Attempts by dest_port, src_ip, client_country
0 Karma

somesoni2
Revered Legend

How about this

sourcetype="juniper" reason="policy deny" src_zone="UNTRUST" | lookup geoip clientip as src_ip | stats dc(dest_port) as Total_Port_Attempted count as Tota_Denies dc(des_ip) as Total_DestIP_Attempted by src_ip,client_country
Get Updates on the Splunk Community!

Developer Spotlight with Brett Adams

In our third Spotlight feature, we're excited to shine a light on Brett—a Splunk consultant, innovative ...

Index This | What can you do to make 55,555 equal 500?

April 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...