<?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 with multiple subnets in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629924#M218842</link>
    <description>&lt;P&gt;Yes, I have multivalue field, I did&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| mvexpand subnets&lt;/P&gt;&lt;P&gt;but how to make comparison, if ip belongs TO ONE of this subnets - then alert?&lt;/P&gt;&lt;P&gt;because now it&amp;nbsp;checks the compliance of each ip with each subnet, for my example table&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;ip&lt;/TD&gt;&lt;TD width="50%"&gt;subnets&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;10.0.0.2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;10.0.0.0/24&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;10.0.0.3&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;10.0.0.0/24&lt;/P&gt;&lt;P&gt;172.24.23.23/24&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;search will find 10.0.0.3 which not matches 172.24.23.23/24, but I need make search where if 10.0.0.3 matches even one of subnets&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 14:32:32 GMT</pubDate>
    <dc:creator>bosseres</dc:creator>
    <dc:date>2023-02-07T14:32:32Z</dc:date>
    <item>
      <title>How to search with cidrmatch with multiple subnets?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629910#M218837</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I got such table after search&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ip&lt;/TD&gt;
&lt;TD width="50%"&gt;subnets&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;&lt;SPAN&gt;10.0.0.2&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="50%"&gt;
&lt;P&gt;10.0.0.0/24&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;10.0.0.3&lt;/TD&gt;
&lt;TD width="50%"&gt;
&lt;P&gt;10.0.0.0/24&lt;/P&gt;
&lt;P&gt;172.24.23.23/24&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to compare if ip belongs to subnets, using next one comparison&lt;/P&gt;
&lt;P&gt;| eval match=if(cidrmatch(subnets, ip), "match", "nomatch")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;It works correct if there is one subnet, but if more - not, how can I correct my search query?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 16:21:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629910#M218837</guid>
      <dc:creator>bosseres</dc:creator>
      <dc:date>2023-02-09T16:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cidrmatch with multiple subnets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629918#M218839</link>
      <description>&lt;P&gt;If subnets is a multi-value field, use mvexpand before the eval, otherwise use split to create a multi-value field and mvexpand.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 13:52:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629918#M218839</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-02-07T13:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cidrmatch with multiple subnets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629924#M218842</link>
      <description>&lt;P&gt;Yes, I have multivalue field, I did&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| mvexpand subnets&lt;/P&gt;&lt;P&gt;but how to make comparison, if ip belongs TO ONE of this subnets - then alert?&lt;/P&gt;&lt;P&gt;because now it&amp;nbsp;checks the compliance of each ip with each subnet, for my example table&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;ip&lt;/TD&gt;&lt;TD width="50%"&gt;subnets&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;10.0.0.2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;10.0.0.0/24&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;10.0.0.3&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;10.0.0.0/24&lt;/P&gt;&lt;P&gt;172.24.23.23/24&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;search will find 10.0.0.3 which not matches 172.24.23.23/24, but I need make search where if 10.0.0.3 matches even one of subnets&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 14:32:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629924#M218842</guid>
      <dc:creator>bosseres</dc:creator>
      <dc:date>2023-02-07T14:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cidrmatch with multiple subnets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629926#M218844</link>
      <description>&lt;P&gt;I mean I want to do, if ip matches at least one of subnets - then field match=match&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 14:33:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629926#M218844</guid>
      <dc:creator>bosseres</dc:creator>
      <dc:date>2023-02-07T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cidrmatch with multiple subnets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629928#M218845</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mvexpand subnets
| stats values(eval(if(cidrmatch(subnets, ip), subnets, null()))) as matches by ip&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 07 Feb 2023 14:41:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/629928#M218845</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-02-07T14:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cidrmatch with multiple subnets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/630061#M218875</link>
      <description>&lt;P&gt;This is confusing as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;already explained you could use mvexpand. &amp;nbsp;Can you explain why this does not give you what you need?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mvexpand subnets
| where cidrmatch(subnets, ip)&lt;/LI-CODE&gt;&lt;P&gt;Suppose there are multiple subnets in the original table and ip matches one of them. &amp;nbsp;Is there any use of the non-matching subnets?&lt;/P&gt;&lt;P&gt;If there is any such use, ITWhisperer's last response covers it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 09:52:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/630061#M218875</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-02-08T09:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cidrmatch with multiple subnets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/630259#M218962</link>
      <description>&lt;P&gt;thank you, sir!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 10:31:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-with-cidrmatch-with-multiple-subnets/m-p/630259#M218962</guid>
      <dc:creator>bosseres</dc:creator>
      <dc:date>2023-02-09T10:31:45Z</dc:date>
    </item>
  </channel>
</rss>

