<?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: Why cant i supply a field as value for mvfilter? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450562#M127581</link>
    <description>&lt;P&gt;Hi rich, thanks for reply. I only get &lt;CODE&gt;Error in 'eval' command: The arguments to the 'mvfilter' function are invalid.&lt;/CODE&gt; when i do &lt;CODE&gt;| eval excludes = mvfilter( NOT in(mymvfield, 'exclude_me') )&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2019 12:32:18 GMT</pubDate>
    <dc:creator>christoffertoft</dc:creator>
    <dc:date>2019-06-27T12:32:18Z</dc:date>
    <item>
      <title>Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450560#M127579</link>
      <description>&lt;P&gt;I'm trying to exclude a value from a multivalue list, but it only works when I input the string as a value, not as a field.&lt;/P&gt;

&lt;P&gt;I understand that it takes a regex as part of its expression, so is there any way i can accommodate that?&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
`&lt;BR /&gt;
|makeresults&lt;BR /&gt;
| eval mymvfield ="a b c"&lt;BR /&gt;
| makemv mymvfield&lt;BR /&gt;
| eval exclude_me = "b"&lt;BR /&gt;
| eval excludes = mvfilter(NOT in(mymvfield, exclude_me))&lt;/P&gt;

&lt;P&gt;`&lt;/P&gt;

&lt;P&gt;Doesnt work.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
| eval mymvfield ="a b c"&lt;BR /&gt;
| makemv mymvfield&lt;BR /&gt;
| eval excludes = mvfilter(NOT in(mymvfield, "b"))&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;works however. Ive tried &lt;CODE&gt;$exclude_me$, "$exclude_me$"&lt;/CODE&gt; etc without luck.. &lt;/P&gt;

&lt;P&gt;I need to be able to exclude a value per row, based on the current value of &lt;CODE&gt;exclude_me&lt;/CODE&gt; .. There has to be a way for this?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:07:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450560#M127579</guid>
      <dc:creator>christoffertoft</dc:creator>
      <dc:date>2020-09-30T01:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450561#M127580</link>
      <description>&lt;P&gt;Have you tried &lt;CODE&gt;'exclude_me'&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450561#M127580</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-27T12:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450562#M127581</link>
      <description>&lt;P&gt;Hi rich, thanks for reply. I only get &lt;CODE&gt;Error in 'eval' command: The arguments to the 'mvfilter' function are invalid.&lt;/CODE&gt; when i do &lt;CODE&gt;| eval excludes = mvfilter( NOT in(mymvfield, 'exclude_me') )&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450562#M127581</guid>
      <dc:creator>christoffertoft</dc:creator>
      <dc:date>2019-06-27T12:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450563#M127582</link>
      <description>&lt;P&gt;If i do the logic &lt;CODE&gt;| where NOT 'exclude_me' in (mymvfield)&lt;/CODE&gt; the logic works. as soon as i put the exact same string as the argument to the boolean logic in mvfilter it breaks.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450563#M127582</guid>
      <dc:creator>christoffertoft</dc:creator>
      <dc:date>2019-06-27T12:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450564#M127583</link>
      <description>&lt;P&gt;you could use a subsearch like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mymvfield ="a b c" 
| makemv mymvfield 
| eval excludes = mvfilter(NOT in(mymvfield, 
    [| makeresults 
    | eval search = "\"b\"" 
    | return $search]))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;| eval search = "\"b\""&lt;/CODE&gt; would be replaced with your actual search, then literally rename the field you want to &lt;CODE&gt;search&lt;/CODE&gt;&lt;BR /&gt;
don’t quote me, but I don’t think the REGEX data type in splunk can be replaced with a field value, hence the need to use a subsearch to pass an actual string there&lt;BR /&gt;
Note the value of &lt;CODE&gt;search&lt;/CODE&gt; needs to be enclosed in &lt;CODE&gt;" "&lt;/CODE&gt;, so you may need to do an eval before calling return to add the double quotes&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:56:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/450564#M127583</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2019-06-27T12:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/511232#M143238</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/MultivalueEvalFunctions#mvfilter.28X.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/MultivalueEvalFunctions#mvfilter.28X.29&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mvfilter(!MyField LIKE "%not_this_text%")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Jul 2020 21:29:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/511232#M143238</guid>
      <dc:creator>tmontney</dc:creator>
      <dc:date>2020-07-27T21:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/532043#M150301</link>
      <description>&lt;P&gt;More than 1 year late, but a solution without any subsearch is :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval mymvfield ="a b c" 
| makemv mymvfield 
| eval exclude_me = "b"
| eval excludes = mvmap(mymvfield,if(!match(mymvfield,exclude_me),mymvfield,0))
|eval excludes = mvfilter(excludes!="0")&lt;/LI-CODE&gt;&lt;P&gt;`mvmap` will apply a condition on all the field of the multivalue fields (in this case replace the excluded fields with "0"&lt;BR /&gt;then we filter on everything that is not "0"&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 15:53:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/532043#M150301</guid>
      <dc:creator>vgtk4431</dc:creator>
      <dc:date>2020-12-04T15:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why cant i supply a field as value for mvfilter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/574220#M200116</link>
      <description>&lt;P&gt;Great solution. using null or "" instead of 0 seems to exclude the need for the last mvfilter.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 15:27:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-cant-i-supply-a-field-as-value-for-mvfilter/m-p/574220#M200116</guid>
      <dc:creator>elewis1</dc:creator>
      <dc:date>2021-11-09T15:27:22Z</dc:date>
    </item>
  </channel>
</rss>

