<?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 Regex for CIDR exclusion in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476477#M133786</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Need some help with getting a correct Regex for CIDR exclusion.&lt;/P&gt;

&lt;P&gt;*(This is an example. Not the real IP range. )&lt;/P&gt;

&lt;P&gt;Trying to exclude events that have ips in the 79.40.96.0/22 range.&lt;/P&gt;

&lt;P&gt;Following is the Regex that I was able to create using &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;. It does match when I test with IPs from the range, in &lt;A href="https://regex101.com"&gt;https://regex101.com&lt;/A&gt;. However it doesn't seem to work when I test it against events in Splunk.&lt;/P&gt;

&lt;P&gt;And the regex used is:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^79\.40\.(96\.([1-9]|[1-9]\d|[12]\d\d)|99\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-4])|9[78]\.([1-9]?\d|[12]\d\d))$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;(Looked like it didn't get pasted correctly when I posted initially.)&lt;/P&gt;

&lt;P&gt;Sample event would start with the ip.&lt;/P&gt;

&lt;P&gt;79.40.96.12 .......&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;AKN&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2020 09:42:55 GMT</pubDate>
    <dc:creator>aknsun</dc:creator>
    <dc:date>2020-01-08T09:42:55Z</dc:date>
    <item>
      <title>Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476477#M133786</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Need some help with getting a correct Regex for CIDR exclusion.&lt;/P&gt;

&lt;P&gt;*(This is an example. Not the real IP range. )&lt;/P&gt;

&lt;P&gt;Trying to exclude events that have ips in the 79.40.96.0/22 range.&lt;/P&gt;

&lt;P&gt;Following is the Regex that I was able to create using &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;. It does match when I test with IPs from the range, in &lt;A href="https://regex101.com"&gt;https://regex101.com&lt;/A&gt;. However it doesn't seem to work when I test it against events in Splunk.&lt;/P&gt;

&lt;P&gt;And the regex used is:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^79\.40\.(96\.([1-9]|[1-9]\d|[12]\d\d)|99\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-4])|9[78]\.([1-9]?\d|[12]\d\d))$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;(Looked like it didn't get pasted correctly when I posted initially.)&lt;/P&gt;

&lt;P&gt;Sample event would start with the ip.&lt;/P&gt;

&lt;P&gt;79.40.96.12 .......&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;AKN&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 09:42:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476477#M133786</guid>
      <dc:creator>aknsun</dc:creator>
      <dc:date>2020-01-08T09:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476478#M133787</link>
      <description>&lt;P&gt;@aknsun &lt;/P&gt;

&lt;P&gt;Have you tried &lt;CODE&gt;cidrmatch&lt;/CODE&gt; function for exclusion ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   ... |where NOT cidrmatch("79.40.96.0/22",ipfield)  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jan 2020 09:51:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476478#M133787</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-08T09:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476479#M133788</link>
      <description>&lt;P&gt;Hi @kamlesh_vaghela  I'm trying to get this done in props/transforms as I don't want it ingested into Splunk.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;AKN&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 10:23:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476479#M133788</guid>
      <dc:creator>aknsun</dc:creator>
      <dc:date>2020-01-08T10:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476480#M133789</link>
      <description>&lt;P&gt;@aknsun &lt;BR /&gt;
Can you please share some sample events?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 12:23:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476480#M133789</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-08T12:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476481#M133790</link>
      <description>&lt;P&gt;@aknsun ,&lt;/P&gt;

&lt;P&gt;Can you please remove the $ from the end of your regex and try. your regex should looks like below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^79\.40\.(96\.([1-9]|[1-9]\d|[12]\d\d)|99\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-4])|9[78]\.([1-9]?\d|[12]\d\d))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 16:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476481#M133790</guid>
      <dc:creator>techiesid</dc:creator>
      <dc:date>2020-01-09T16:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476482#M133791</link>
      <description>&lt;P&gt;Hi @techiesid . It didn't work.&lt;/P&gt;

&lt;P&gt;Sample event has a comma immediatley after the IP.&lt;/P&gt;

&lt;P&gt;79.40.96.12, ........&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 02:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476482#M133791</guid>
      <dc:creator>aknsun</dc:creator>
      <dc:date>2020-01-10T02:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476483#M133792</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval ip=split("79.40.96.#79.40.97.#79.40.98.#79.40.99.","#")
| stats count by ip
| eval subnet=mvrange(0,255)
| stats values(ip) as ip by subnet
| mvexpand ip
| eval ip=ip.subnet
| eval check=if(match(ip,"79\.40\.9[6-9]\.[1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]"),"OK","false")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;79.40.96.0/22&lt;/CODE&gt; is the range &lt;EM&gt;79.40.96.0 ~ 79.40.99.255&lt;/EM&gt;&lt;BR /&gt;
the regex is &lt;CODE&gt;match()&lt;/CODE&gt; args. &lt;/P&gt;</description>
      <pubDate>Sun, 26 Jan 2020 04:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476483#M133792</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-26T04:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for CIDR exclusion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476484#M133793</link>
      <description>&lt;P&gt;I got this working. Just had to replace the "$" with a ".*" at the end of the REGEX.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^79\.40\.(96\.([1-9]|[1-9]\d|[12]\d\d)|99\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-4])|9[78]\.([1-9]?\d|[12]\d\d)).*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jan 2020 06:28:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-CIDR-exclusion/m-p/476484#M133793</guid>
      <dc:creator>aknsun</dc:creator>
      <dc:date>2020-01-28T06:28:50Z</dc:date>
    </item>
  </channel>
</rss>

