<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cidrmatch function not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154686#M43492</link>
    <description>&lt;P&gt;Hi Ronvgraham,&lt;/P&gt;

&lt;P&gt;this works perfectly:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval IP_add="11.10.10.10" 
| eval network=if(cidrmatch("10.0.0.0/8", IP_add), "Network", "other")
| stats count by IP_add,network
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What does your regex match? Is the field value returned numeric or alphanumeric?&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jun 2015 23:08:54 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2015-06-11T23:08:54Z</dc:date>
    <item>
      <title>cidrmatch function not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154685#M43491</link>
      <description>&lt;P&gt;I have imported two Cisco firewall configurations and I am trying to extract IP addresses for our local machines.  Therefore I only want to match on subnets that are within our control.  I have put together the following command to match on one of our private ip ranges but it appears to always be defaulting to other:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=fw 
| rex max_match=5 "(?P&amp;lt;IP_add&amp;gt;\s\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" 
| eval network=if(cidrmatch("10.0.0.0/8", IP_add), "Network", "other")
| stats count by IP_add,network
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have also tried to use the &lt;CODE&gt;| where NOT cidrmatch("10.0.0.0/8",IP_add)&lt;/CODE&gt;  notation but that does not seem to select the proper subnets either.  Can someone help me understand why the cidrmatch function does not appear to be working for my searches.  &lt;/P&gt;

&lt;P&gt;Do I have to set up the transforms file to use the cidrmatch function and if so can someone help me with the proper code to get this done based on the above?  &lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 22:56:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154685#M43491</guid>
      <dc:creator>Ronvgraham</dc:creator>
      <dc:date>2015-06-11T22:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: cidrmatch function not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154686#M43492</link>
      <description>&lt;P&gt;Hi Ronvgraham,&lt;/P&gt;

&lt;P&gt;this works perfectly:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval IP_add="11.10.10.10" 
| eval network=if(cidrmatch("10.0.0.0/8", IP_add), "Network", "other")
| stats count by IP_add,network
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What does your regex match? Is the field value returned numeric or alphanumeric?&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 23:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154686#M43492</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-06-11T23:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: cidrmatch function not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154687#M43493</link>
      <description>&lt;P&gt;I tried your example and it works properly on my system as well.  When I run my original example the regex matches "other" for all IP addresses even though some of them are in the 10.x.x.x subnet.  The fields that were generated by my regex are alphanumeric.  &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 14:50:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154687#M43493</guid>
      <dc:creator>Ronvgraham</dc:creator>
      <dc:date>2015-06-12T14:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: cidrmatch function not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154688#M43494</link>
      <description>&lt;P&gt;To add some more information.  With my regex there may be more than one IP address on a line so it may add more than one IP address to the IP_add field.  This may be related to the problem.  &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 15:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/cidrmatch-function-not-working/m-p/154688#M43494</guid>
      <dc:creator>Ronvgraham</dc:creator>
      <dc:date>2015-06-12T15:19:17Z</dc:date>
    </item>
  </channel>
</rss>

