<?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 filter out IPv6 and 169.254.0.0/16 from a multi-value field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-out-IPv6-and-169-254-0-0-16-from-a-multi-value/m-p/635813#M220895</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229089"&gt;@mag314&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I suggest you split and mvexpand the IP LIST field (note, I've used IP_LIST to avoid quoting so change as necessary), then filter with a where clause, like this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval _raw="HOST IP_LIST&lt;BR /&gt;hostA 10.0.0.3, 10.3.4.6, 169.254.1.5, fe80::2000:aff:fea7:f7c&lt;BR /&gt;hostB 10.0.0.2, 192.168.3.12, 169.254.8.9, fe80::2000:aff:fea7:d3c"&lt;BR /&gt;| multikv&lt;BR /&gt;| table HOST IP_LIST&lt;BR /&gt;``` ^^^ ignore above - just creating dummy events ^^^ ```&lt;BR /&gt;``` add the following SPL ```&lt;BR /&gt;| eval IP_LIST=split(IP_LIST, ", ") ``` make IP_LIST a multivalue field ```&lt;BR /&gt;| mvexpand IP_LIST&lt;BR /&gt;| where cidrmatch("fe80:2000::/16",IP_LIST) OR cidrmatch("169.254.0.0/16", IP_LIST)&lt;BR /&gt;``` and if you want to reformat the event to look as before, then ... ```&lt;BR /&gt;| stats values(IP_LIST) AS IP_LIST BY HOST&lt;BR /&gt;| eval IP_LIST=mvjoin(IP_LIST, ", ")&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yeahnah_0-1679624540401.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24493i910836A909E04D51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yeahnah_0-1679624540401.png" alt="yeahnah_0-1679624540401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Note, this answer may have some useful info on IPv6 and cidr matching&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-use-the-cidrmatch-function-with-IPV6-IP-addresses/m-p/134337" target="_blank" rel="noopener"&gt;Solved: How to use the cidrmatch() function with IPV6 IP a... - Splunk Community &lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;</description>
    <pubDate>Fri, 24 Mar 2023 02:25:22 GMT</pubDate>
    <dc:creator>yeahnah</dc:creator>
    <dc:date>2023-03-24T02:25:22Z</dc:date>
    <item>
      <title>How to filter out IPv6 and 169.254.0.0/16 from a multi-value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-out-IPv6-and-169-254-0-0-16-from-a-multi-value/m-p/635731#M220872</link>
      <description>&lt;P&gt;How do you filter out IPv6 and internal routed 169.254.0.0/16 from a multi-value field?&lt;/P&gt;&lt;P&gt;Data Example&lt;BR /&gt;HOST&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP LIST&lt;BR /&gt;hostA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10.0.0.3, 10.3.4.6, 169.254.1.5, fe80::2000:aff:fea7:f7c&lt;BR /&gt;hostB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10.0.0.2, 192.168.3.12, 169.254.8.9, fe80::2000:aff:fea7:d3c&lt;/P&gt;&lt;P&gt;I have attempted using a number of combinations of mvfilter, match, cidrmatch and I can't get it to work.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN&gt; eval&lt;/SPAN&gt; &lt;SPAN&gt;ip_list_filter_IPv6 &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;mvfilter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;match&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ip_list_orig&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"/\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\b"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN&gt; eval&lt;/SPAN&gt; &lt;SPAN&gt;ip_list_filter_169 &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;mvfilter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;match&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ip_list_filter_IPv6, &lt;/SPAN&gt;&lt;SPAN&gt;NOT&lt;/SPAN&gt; &lt;SPAN&gt;cidrmatch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;169&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;254&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;ip_list_filter_IPv6))&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I thought cidrmatch might do it all but I believe it is not a validation macro but one that checks if an IP is in a given range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 14:49:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-out-IPv6-and-169-254-0-0-16-from-a-multi-value/m-p/635731#M220872</guid>
      <dc:creator>mag314</dc:creator>
      <dc:date>2023-03-23T14:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter out IPv6 and 169.254.0.0/16 from a multi-value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-out-IPv6-and-169-254-0-0-16-from-a-multi-value/m-p/635813#M220895</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229089"&gt;@mag314&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I suggest you split and mvexpand the IP LIST field (note, I've used IP_LIST to avoid quoting so change as necessary), then filter with a where clause, like this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval _raw="HOST IP_LIST&lt;BR /&gt;hostA 10.0.0.3, 10.3.4.6, 169.254.1.5, fe80::2000:aff:fea7:f7c&lt;BR /&gt;hostB 10.0.0.2, 192.168.3.12, 169.254.8.9, fe80::2000:aff:fea7:d3c"&lt;BR /&gt;| multikv&lt;BR /&gt;| table HOST IP_LIST&lt;BR /&gt;``` ^^^ ignore above - just creating dummy events ^^^ ```&lt;BR /&gt;``` add the following SPL ```&lt;BR /&gt;| eval IP_LIST=split(IP_LIST, ", ") ``` make IP_LIST a multivalue field ```&lt;BR /&gt;| mvexpand IP_LIST&lt;BR /&gt;| where cidrmatch("fe80:2000::/16",IP_LIST) OR cidrmatch("169.254.0.0/16", IP_LIST)&lt;BR /&gt;``` and if you want to reformat the event to look as before, then ... ```&lt;BR /&gt;| stats values(IP_LIST) AS IP_LIST BY HOST&lt;BR /&gt;| eval IP_LIST=mvjoin(IP_LIST, ", ")&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yeahnah_0-1679624540401.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24493i910836A909E04D51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yeahnah_0-1679624540401.png" alt="yeahnah_0-1679624540401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Note, this answer may have some useful info on IPv6 and cidr matching&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-use-the-cidrmatch-function-with-IPV6-IP-addresses/m-p/134337" target="_blank" rel="noopener"&gt;Solved: How to use the cidrmatch() function with IPV6 IP a... - Splunk Community &lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 02:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-out-IPv6-and-169-254-0-0-16-from-a-multi-value/m-p/635813#M220895</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-03-24T02:25:22Z</dc:date>
    </item>
  </channel>
</rss>

