<?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: How to combine a range of multiple IP address  and compare it to a variable in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565893#M197177</link>
    <description>&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="src
10.161.5.50
10.161.5.51
10.161.5.52
10.161.5.53
10.161.10.20
192.168.1.120
192.168.1.130
10.161.5.54
10.161.10.21
192.168.1.121
192.168.1.131"
| multikv forceheader=1
| table src



| regex src!="10.161.5.5[0-3]|10.161.10.20|192.168.1.1[2-3]0"&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 04 Sep 2021 08:58:50 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-09-04T08:58:50Z</dc:date>
    <item>
      <title>How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565635#M197090</link>
      <description>&lt;P&gt;So, I have multiple ip addresses i want to combine them using regex or normal by supplying dashes and compare them to the variable.&lt;/P&gt;&lt;P&gt;For eg:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is my existing query:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;| search NOT src IN (10.161.5.50 , 10.161.5.51,10.161.5.52,&amp;nbsp;10.161.5.53,10.161.10.20,192.168.1.120,192.168.1.130 )&lt;BR /&gt;&lt;BR /&gt;I had an output of &lt;STRONG&gt;15 matched&lt;/STRONG&gt;&amp;nbsp;output.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;What i have tried doing to get result is:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;| search NOT src IN ("10.161.5.5[0-3]", 10.161.10.20,192.168.1.120,192.168.1.130)&lt;STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Doing this lead to an increase in the matched query up to 30 results. Why was this happening and what can i do to prevent it.&lt;BR /&gt;&lt;BR /&gt;Any solutions?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 09:15:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565635#M197090</guid>
      <dc:creator>commanman</dc:creator>
      <dc:date>2021-09-02T09:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565831#M197161</link>
      <description>&lt;P&gt;is that your entire splunk search?&amp;nbsp; or is that just a portion of a larger search that is trying to filter results?&amp;nbsp; i've been out of the splunk game for a bit, but i don't think the search command supports regex.&amp;nbsp; if this is filtering results in a larger search, then maybe using the where command with the match function is more appropriate.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 15:44:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565831#M197161</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2021-09-03T15:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565860#M197168</link>
      <description>&lt;P&gt;Firstly, Splunk supports only wildcard pattern-matching on search, not regex.&lt;/P&gt;&lt;P&gt;Secondly, be very careful when using negations. Maybe this is not the case, but remember that "src_ip!=127.0.0.1" is not equivalent of "NOT src_ip=127.0.0.1"&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 20:43:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565860#M197168</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-03T20:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565874#M197172</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190949"&gt;@maciep&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;it is a portion of my larger query.&lt;/P&gt;&lt;P&gt;So i have a correlation search which detects scanner in on my &lt;SPAN&gt;Infrastructure&amp;nbsp;&lt;/SPAN&gt;assets but there are some legitmate ip address assigned to the server which should be excluded from the matching then source.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For eg:&lt;/P&gt;&lt;P&gt;Attacker scans my webserver having IP of 123.2.3.245&amp;nbsp;&lt;/P&gt;&lt;P&gt;Me scanning the webserver having ip address 10.10.10.10&lt;/P&gt;&lt;P&gt;Internal unauthorized employee scanning for the webserver&amp;nbsp; 10.1.10.20&lt;/P&gt;&lt;P&gt;Coming to my point is that there a search query in place which detect these and stores in a variable called src.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Now i wont to exclude a range of ip address like 10 -20 ip address for scanning in the same background creating a lookup for that would be a waste of resources.&lt;BR /&gt;&lt;BR /&gt;Hence, I query&amp;nbsp; looks like this&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;| search NOT src IN (&lt;STRONG&gt;10.161.5.50,&amp;nbsp;10.161.5.51,&amp;nbsp;10.161.5.52, 10.161.5.53,&lt;/STRONG&gt; 10.161.10.20, 192.168.1.120, 192.168.1.130 )&lt;BR /&gt;&lt;BR /&gt;What i want to do is group those near by ip address&lt;BR /&gt;&lt;BR /&gt;| search NOT src IN (&lt;STRONG&gt;10.161.5.5[0-3],&lt;/STRONG&gt;&amp;nbsp;10.161.10.20, 192.168.1.120, 192.168.1.130 )&lt;BR /&gt;something on these lines.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;I have seen few regex/ ip commands on the forum which are used. But i a bit confused what would work here&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this makes any sense to you guys.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 00:47:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565874#M197172</guid>
      <dc:creator>commanman</dc:creator>
      <dc:date>2021-09-04T00:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565893#M197177</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="src
10.161.5.50
10.161.5.51
10.161.5.52
10.161.5.53
10.161.10.20
192.168.1.120
192.168.1.130
10.161.5.54
10.161.10.21
192.168.1.121
192.168.1.131"
| multikv forceheader=1
| table src



| regex src!="10.161.5.5[0-3]|10.161.10.20|192.168.1.1[2-3]0"&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 04 Sep 2021 08:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565893#M197177</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-04T08:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565919#M197190</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; for helping out.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 01:44:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565919#M197190</guid>
      <dc:creator>commanman</dc:creator>
      <dc:date>2021-09-05T01:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine a range of multiple IP address  and compare it to a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565943#M197206</link>
      <description>&lt;P&gt;Just remember that performance--wise that might not be a best choice.&lt;/P&gt;&lt;P&gt;OK, if you have a small data set to search, no problem. But if the index grows...&lt;/P&gt;&lt;P&gt;Well, let me show you.&lt;/P&gt;&lt;P&gt;I have a linux_auditd index. I did a search on it:&lt;/P&gt;&lt;PRE&gt;index=linux_auditd addr=119*&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This is the heading of the job inspector:&lt;/P&gt;&lt;PRE&gt;This search has completed and has returned &lt;SPAN class="emphatic"&gt;11,223&lt;/SPAN&gt; results by scanning &lt;SPAN class="emphatic"&gt;51,721&lt;/SPAN&gt; events in &lt;SPAN class="emphatic"&gt;3.754 &lt;/SPAN&gt; seconds&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;For comparison I did another one matching events by regex:&lt;/P&gt;&lt;PRE&gt;index=linux_auditd &lt;BR /&gt;| regex addr="^119\..*"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This time the job inspector said:&lt;/P&gt;&lt;PRE&gt;This search has completed and has returned &lt;SPAN class="emphatic"&gt;11,223&lt;/SPAN&gt; results by scanning &lt;SPAN class="emphatic"&gt;3,569,498&lt;/SPAN&gt; events in &lt;SPAN class="emphatic"&gt;236.314 &lt;/SPAN&gt; seconds&lt;/PRE&gt;&lt;P&gt;As you can see, the difference in run time and number of scanned events is huge.&lt;/P&gt;&lt;P&gt;If you do the similar check for yourself you'll see why - in case of field value matching splunk is checking the provided pattern "intelligently" against the index which holds not only raw data but also a summary of the data split into a form of lexical units. So it only had to verify 51 thousand of occurences of "119" pattern to check whether the involved events parse out the value as the needed field.&lt;/P&gt;&lt;P&gt;If you do a "blank" search and then pipe it to regex, splunk reads every single event from a given timeframe and then tries to match it to the given regex.&lt;/P&gt;&lt;P&gt;That's why the difference in execution time is so huge.&lt;/P&gt;&lt;P&gt;It's best to narrow down the search condition as much as you can and only then try to perform additional operations on the data.&lt;/P&gt;&lt;P&gt;Of course - as I wrote before - if your dataset is small, the difference will be negligible and you're good to go with any option but it's good to know the difference.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 17:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-a-range-of-multiple-IP-address-and-compare-it-to/m-p/565943#M197206</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-05T17:24:55Z</dc:date>
    </item>
  </channel>
</rss>

