Splunk Search

… | where like(src, “10.9.165.%”) OR cidrmatch(“10.9.165.0/25”, dst) What will this search return as a result?

rashokciet
New Member

… | where like(src, “10.9.165.%”) OR cidrmatch(“10.9.165.0/25”, dst)

What will this search return as a result?

Any help is appreciated..!

0 Karma
1 Solution

ngatchasandra
Builder

Hi,

I think that It return events that match the IP or is in the specified subnet.

This because:

  • the like(x,y) funtion This function takes two arguments, a field X and a quoted string Y, and
    returns TRUE if and only if the first argument is like the SQLite pattern in y

  • the cidrmacth(x,y) function identifies IP addresses that belong to a particular subnet. The function uses two arguments: the first is the CIDR subnet, is contained in quotes; the second is the IP address to match, which may be values in field.

View solution in original post

0 Karma

esix_splunk
Splunk Employee
Splunk Employee

By syntax, CIDRMATCH("10.9.165.0/25",dst) will return 10.9.165 - 166. 1 - 254.

Whereas.. WHERE like(src,"10.9.165.%") will only return any src that is 10.9.165.x.

0 Karma

Runals
Motivator

Actually cidermatch("10.9.165.0/25", dst) will return values between 10.9.165.0 - 10.9.165.127
where like(src, "10.9.165.%") will return values that simply start with "10.9.165." and while one might assume validation has already been done to the data in "src" it will match 0-255 but also any string of characters

ngatchasandra
Builder

Hi,

I think that It return events that match the IP or is in the specified subnet.

This because:

  • the like(x,y) funtion This function takes two arguments, a field X and a quoted string Y, and
    returns TRUE if and only if the first argument is like the SQLite pattern in y

  • the cidrmacth(x,y) function identifies IP addresses that belong to a particular subnet. The function uses two arguments: the first is the CIDR subnet, is contained in quotes; the second is the IP address to match, which may be values in field.

0 Karma

rashokciet
New Member

Could you please explain how it works??

Thanks for the help in advance

0 Karma

ngatchasandra
Builder

Yes!

This because:

  • the like(x,y) funtion This function takes two arguments, a field X and a quoted string Y, and returns TRUE if and only if the first argument is like the SQLite pattern in y

  • the cidrmacth(x,y) function identifies IP addresses that belong to a particular subnet. The function uses two arguments: the first is the CIDR subnet, is contained in quotes; the second is the IP address to match, which may be values in field.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...