Splunk Search

How to display the source ip which does not fall under cidr range specified in a lookup table?

Pooja_R
Loves-to-Learn Lots

I have a lookup table with allowed CIDR ranges.

allowed_cidr_range      applications

Xyx                                             abc

I need to build a alert whenever source ip does not belong to the allowed cidr range.

Query :

NOT [| lookup cidr_vpc.csv allowed_cidr_range as src_ip output allowed_cidr_range]

|table _time,host,sourcetype,src_ip,dst_ip

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this (assuming the lookup type is defined as being CIDR)

| lookup cidr_vpc.csv allowed_cidr_range as src_ip output applications]
| where isnull(applications)
| table _time,host,sourcetype,src_ip,dst_ip

 

0 Karma

Pooja_R
Loves-to-Learn Lots

Hi

The lookup table looks something  like

allowed_cidr            applications

10.7.0.0/16                 dev

10.16.0.0/26               non_prod_server

I want to consider allowed_cidr as source ip and display the addresses not in  cidrmatch

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Look up the src_ip (make sure the lookup definition says CIDR match)

If the lookup finds a match then the src_ip is allowed, therefore, if there is no match applications will be null

| lookup cidr_vpc.csv allowed_cidr as src_ip OUTPUT applications
| where isnull(applications)
| table _time,host,sourcetype,src_ip,dst_ip
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!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...