Splunk Dev

How does cidrmatch work?

danielbb
Motivator

The following code -

| eval ipa="10.22.3.2" 
| eval ret=if(cidrmatch("10.0.0.0/8", ipa), "tr", "fl") 
| return ret

Returns -

alt text

Why is that?

Tags (1)
0 Karma
1 Solution

harsmarvania57
Ultra Champion

It is correct, because IP 10.22.3.2 belongs to CIDR Range 10.0.0.0/8 -> 10.0.0.0-10.255.255.255

View solution in original post

harsmarvania57
Ultra Champion

It is correct, because IP 10.22.3.2 belongs to CIDR Range 10.0.0.0/8 -> 10.0.0.0-10.255.255.255

danielbb
Motivator

Very kind @harsmarvania57 - please convert to an answer...

0 Karma

danielbb
Motivator

Ok,

by adding the makeresults

| makeresults
| eval ipa="10.22.3.2" 
| eval ret=if(cidrmatch("10.0.0.0/8", ipa), "tr", "fl")
| return ret

I get ret="tr".

Not sure whether ret="tr" is correct...

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...