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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...