<?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: Using Regex to search events from a specific ip range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543412#M153928</link>
    <description>&lt;P&gt;If you are filtering data only on host=1.1.1.* then you can filter it using logical operators in the base search only:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=n sourcetype=c message_text="you should not have done that" (host&amp;gt;="1.1.1.23" AND host&amp;lt;="1.1.1.51") NOT (host&amp;gt;="1.1.1.38" AND host&amp;lt;="1.1.1.44") host!="1.1.1.26" host!="1.1.1.32"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Mar 2021 15:38:42 GMT</pubDate>
    <dc:creator>manjunathmeti</dc:creator>
    <dc:date>2021-03-11T15:38:42Z</dc:date>
    <item>
      <title>Using Regex to search events from a specific ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543397#M153923</link>
      <description>&lt;P&gt;Hello, I am new to Splunk and REGEX for that matter. What I am trying to accomplish is creating an alert when a specific event occurs with in an IP range without having to create an alert for every IP individually. Here is my very basic query.&lt;/P&gt;&lt;P&gt;index=n sourcetype=c message_text="you should not have done that" host="1.1.1.?" I put the question mark in there because this where I am stuck. The last octet is a range beginning at 23, and ending at 51. Excluding .26, .32, and .38-.44. Thank you for your time.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 15:11:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543397#M153923</guid>
      <dc:creator>813_Gerb</dc:creator>
      <dc:date>2021-03-11T15:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using Regex to search events from a specific ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543405#M153926</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you should try&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchReference/ConditionalFunctions#cidrmatch.28.22X.22.2CY.29" target="_blank"&gt;cidrmatch("X",Y)&lt;/A&gt;.There are also quite many examples how to use lookups for that.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| where cidrmatch ("1.1.1.x/2x", &amp;lt;your IP&amp;gt;) OR cidrmatch("1.1.1.y/2y", &amp;lt;your IP) ....&lt;/LI-CODE&gt;&lt;P&gt;As you haven't "clean" IP blocks, you must match those to suitable blocks and/or use larger block and then remove unwanted IPs.&lt;/P&gt;&lt;P&gt;r. Ismo.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 15:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543405#M153926</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-03-11T15:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Regex to search events from a specific ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543406#M153927</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;search&lt;/FONT&gt; command, which is implied before the first pipe, does not support regular expressions.&amp;nbsp; The best you can do is use a wildcard to grab a larger set of IP addresses and trim the set with later commands.&lt;/P&gt;&lt;P&gt;The listed requirements don't lend themselves to a clean regex string, but perhaps this will help.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=n sourcetype=c message_text="you should not have done that" host="1.1.1.*" 
| eval lastOctet=mvindex(split(host,"."), 3)
| where (lastOctet&amp;gt;=23 AND lastOctet&amp;lt;=51 AND NOT lastOctet IN (26,32,38,39,40,41,42,43,44))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 Mar 2021 15:27:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543406#M153927</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-03-11T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Regex to search events from a specific ip range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543412#M153928</link>
      <description>&lt;P&gt;If you are filtering data only on host=1.1.1.* then you can filter it using logical operators in the base search only:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=n sourcetype=c message_text="you should not have done that" (host&amp;gt;="1.1.1.23" AND host&amp;lt;="1.1.1.51") NOT (host&amp;gt;="1.1.1.38" AND host&amp;lt;="1.1.1.44") host!="1.1.1.26" host!="1.1.1.32"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 15:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Regex-to-search-events-from-a-specific-ip-range/m-p/543412#M153928</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-03-11T15:38:42Z</dc:date>
    </item>
  </channel>
</rss>

