<?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 How to mvfilter() the results of mvappend()? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-mvfilter-the-results-of-mvappend/m-p/596189#M207540</link>
    <description>&lt;P&gt;I have several fields I want to lump into 1 multivalue field and remove blanks.&lt;/P&gt;
&lt;P&gt;At the start of an event, there are up to 6 IP Addresses, either internal or external, but not both (they are the source IP, plus any LB hops along the way). They get extracted to either internal_src_ip# or external_src_ip#.&amp;nbsp; If it is an internal IP, then the external_src_ip# will be "-", i.e. blank.&lt;/P&gt;
&lt;P&gt;If I run&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval OriginIP2 = mvappend(internal_src_ip, external_src_ip, internal_src_ip2, external_src_ip2, internal_src_ip3, external_src_ip3, internal_src_ip4, external_src_ip4, internal_src_ip5, external_src_ip5, internal_src_ip6, external_src_ip6 )
| eval OriginIP2 = mvfilter( match( OriginIP2, "^(?!-)" ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get exactly what I want. A multivalue list in the field "OriginIP2" with "-" removed.&lt;/P&gt;
&lt;P&gt;However putting it together in 1 line (to automate as a Calculated Field) gives me an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval OriginIP2 = mvfilter(  match( mvappend(internal_src_ip, external_src_ip, internal_src_ip2, external_src_ip2, internal_src_ip3, external_src_ip3, internal_src_ip4, external_src_ip4, internal_src_ip5, external_src_ip5, internal_src_ip6, external_src_ip6 ), "^(?!-)") )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Error in 'eval' command: The arguments to the 'mvfilter' function are invalid. &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I read the docs, mvappend() should be returning a single mv field for match() to operate on, and then for match() to send to mvfilter().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2022 16:00:31 GMT</pubDate>
    <dc:creator>woodams</dc:creator>
    <dc:date>2022-05-03T16:00:31Z</dc:date>
    <item>
      <title>How to mvfilter() the results of mvappend()?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-mvfilter-the-results-of-mvappend/m-p/596189#M207540</link>
      <description>&lt;P&gt;I have several fields I want to lump into 1 multivalue field and remove blanks.&lt;/P&gt;
&lt;P&gt;At the start of an event, there are up to 6 IP Addresses, either internal or external, but not both (they are the source IP, plus any LB hops along the way). They get extracted to either internal_src_ip# or external_src_ip#.&amp;nbsp; If it is an internal IP, then the external_src_ip# will be "-", i.e. blank.&lt;/P&gt;
&lt;P&gt;If I run&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval OriginIP2 = mvappend(internal_src_ip, external_src_ip, internal_src_ip2, external_src_ip2, internal_src_ip3, external_src_ip3, internal_src_ip4, external_src_ip4, internal_src_ip5, external_src_ip5, internal_src_ip6, external_src_ip6 )
| eval OriginIP2 = mvfilter( match( OriginIP2, "^(?!-)" ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get exactly what I want. A multivalue list in the field "OriginIP2" with "-" removed.&lt;/P&gt;
&lt;P&gt;However putting it together in 1 line (to automate as a Calculated Field) gives me an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval OriginIP2 = mvfilter(  match( mvappend(internal_src_ip, external_src_ip, internal_src_ip2, external_src_ip2, internal_src_ip3, external_src_ip3, internal_src_ip4, external_src_ip4, internal_src_ip5, external_src_ip5, internal_src_ip6, external_src_ip6 ), "^(?!-)") )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Error in 'eval' command: The arguments to the 'mvfilter' function are invalid. &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I read the docs, mvappend() should be returning a single mv field for match() to operate on, and then for match() to send to mvfilter().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 16:00:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-mvfilter-the-results-of-mvappend/m-p/596189#M207540</guid>
      <dc:creator>woodams</dc:creator>
      <dc:date>2022-05-03T16:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: mvfilter() the results of mvappend()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-mvfilter-the-results-of-mvappend/m-p/596220#M207550</link>
      <description>&lt;P&gt;As the documentation says, mvfilter requires a reference to a mv-field (not a field), which is why your command throws an error. Try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval OriginIP2 = mvappend(if(internal_src_ip="-",null(),internal_src_ip), if(external_src_ip="-",null(),external_src_ip), if(internal_src_ip2="-",null(),internal_src_ip2), if(external_src_ip2="-",null(),external_src_ip2), if(internal_src_ip3="-",null(),internal_src_ip3),if(external_src_ip3="-",null(),external_src_ip3), if(internal_src_ip4="-",null(),internal_src_ip4), if(external_src_ip4="-",null(),external_src_ip4),if(internal_src_ip5="-",null(),internal_src_ip5), if(external_src_ip5="-",null(),external_src_ip5), if(internal_src_ip6="-",null(),internal_src_ip6), if(external_src_ip6="-",null(),external_src_ip6))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 03 May 2022 07:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-mvfilter-the-results-of-mvappend/m-p/596220#M207550</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-03T07:37:11Z</dc:date>
    </item>
  </channel>
</rss>

