Splunk Search

How to use regex to look for hosts from /24, /25, and /26 subnets?


I have a dozen /24 subnets that I am looking to find any IP addresses on that subnet in my search as well as a addresses from several /25 and /26 subnets. Thanks, in advance.

0 Karma

Esteemed Legend

Standard searches and tstats ... where both support native CIDR equalities (but NOT inequalities) and where has cidrmatch() function.

0 Karma


I believe you may make more hay by using a where clause and a cidrmatch function: https://docs.splunk.com/Documentation/Splunk/7.3.2/SearchReference/ConditionalFunctions#cidrmatch.28...
Example: | where cidrmatch("", ip)

If this comment/answer was helpful, please up vote it. Thank you.
0 Karma
Take the 2021 Splunk Career Survey

Help us learn about how Splunk has
impacted your career by taking the 2021 Splunk Career Survey.

Earn $50 in Amazon cash!