Splunk Search

Search for IP Addresses more efficient using wildcards or CIDR ranges

andylee53
New Member

Hello

 

I'm looking to run a search in a Firewall log index for connections to a know IP range and trying to decide which is the more efficient way of doing it. As can be seen I'm excluding certain ports we expect to see traffic on I seem to remember that using "!=" is also considered inefficient as well open to other suggestions for using something else.

Current search looks like this

index="pan_logs" sourcetype="pan:traffic" dest_ip="91.226.*.*" | lookup dnslookup clientip AS src_ip OUTPUT clienthost AS remotehost | search dest_port!=48600 dest_port!=22 | table _time dest_ip dest_port remotehost

Labels (1)
0 Karma

to4kawa
Ultra Champion
index="pan_logs" sourcetype="pan:traffic" dest_ip="91.226.0.0/16" | lookup dnslookup clientip AS src_ip OUTPUT clienthost AS remotehost | table _time dest_ip dest_port remotehost | where dest_port!=48600 OR dest_port!=22
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @andylee53 ,

in general the use of != isn't a best practice in searches!

In my experience the CIDR is more efficient than wildcards.

Ciao.

Giuseppe

0 Karma

andylee53
New Member

@gcusello Many Thanks for the reply. I understood about the use of != but cannot think of a better alternative right now

 

Thanks for confirming the CIDR is more efficient I will give it a try

 

Regards

 

Andy

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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...