Splunk Search

How to whitelist multiple IP addresses from datamodel search? (no need to use lookups)?

dzejsonborn
New Member

Hi Guys,

Can you please tell me how to exclude/whitelist multiple ip adresses from the datamodel search

here is the example:

All_Traffic.dest_ip!=10.10.10.10 All_Traffic.dest_ip!=10.10.10.10 All_Traffic.dest_ip!=10.10.10.13

I would like to have it more clear like: All_Traffic.dest_ip!=10.10.10.10, 10.10.10.10, 10.10.10.13

Unfortunately it doesn't work. Which parameter needs to be used ??

Thanks!

0 Karma
1 Solution

solarboyz1
Builder

You could use the IN operator

... Where NOT  All_Traffic.dest_ip IN (10.10.10.10, 10.10.10.10, 10.10.10.13)

https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Search#Multiple_field-value_compa...

View solution in original post

dzejsonborn
New Member

And later on if I would like to add All_Traffic.dest_port and All_Traffic.transport!
Which parameter I should use ?

I tried:

WHERE NOT (All_Traffic.src_port IN (80, 443) OR NOT All_Traffic.dest_port IN (80, 443, 22, 5060)

but it does not work.

0 Karma

solarboyz1
Builder

I don't know how the NOT outside the parens impacts the NOT inside, also not sure what Logic you are trying to implement.

This will find any events that don't have a src port of 80 or 443 or a dest of 80 443 22 5060.

WHERE ( NOT All_Traffic.src_port IN (80, 443) AND NOT All_Traffic.dest_port IN (80, 443, 22, 5060) )

OR

WHERE NOT  ( All_Traffic.src_port IN (80, 443) OR All_Traffic.dest_port IN (80, 443, 22, 5060) )
0 Karma

dzejsonborn
New Member

and how about IP ranges, for example:

All_Traffic.src_ip IN (10.16.72.20, 10.128.124.0/22)
??

0 Karma

solarboyz1
Builder

As far as I can tell, when using IN the CIDR address is seen as a single value and not as a CIDR value to expand.

You would need to do it the old fashioned way:

All_Traffic.src_ip=10.16.72.20 OR All_Traffic.src_ip=10.128.124.0/22

If you have several individual IPs, you could do those via IN:

WHERE All_Traffic.src_ip IN (10.16.72.20, 10.16.73.20 ) OR  All_Traffic.src_ip=10.128.124.0/22 OR All_Traffic.src_ip=10.34.124.0/22 
0 Karma

solarboyz1
Builder

You could use the IN operator

... Where NOT  All_Traffic.dest_ip IN (10.10.10.10, 10.10.10.10, 10.10.10.13)

https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Search#Multiple_field-value_compa...

dzejsonborn
New Member

Thank you !!!

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...