<?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: Filter MV field for specified value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711670#M240216</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/274960"&gt;@dtaylor&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check this,&amp;nbsp; if a multivalue field contains both "N/A" and at least one non-"N/A" value. If both conditions are met, it removes "N/A" and returns the remaining values otherwise, it keeps the field unchanged.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kiran_panchavat_0-1739599634580.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34534i4555BF76CC2FC8D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kiran_panchavat_0-1739599634580.png" alt="kiran_panchavat_0-1739599634580.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 15 Feb 2025 06:13:49 GMT</pubDate>
    <dc:creator>kiran_panchavat</dc:creator>
    <dc:date>2025-02-15T06:13:49Z</dc:date>
    <item>
      <title>Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711668#M240215</link>
      <description>&lt;P&gt;I've been smashing my head against this issue for the past few hours. I need to check a multivalue field to see if it contains the "N/A" *and* any value that isn't "N/A". If this is true, I need to filter whatever "N/A" exist within the field and return the remaining non-N/A values as a multivalue field.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2025 04:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711668#M240215</guid>
      <dc:creator>dtaylor</dc:creator>
      <dc:date>2025-02-15T04:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711670#M240216</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/274960"&gt;@dtaylor&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check this,&amp;nbsp; if a multivalue field contains both "N/A" and at least one non-"N/A" value. If both conditions are met, it removes "N/A" and returns the remaining values otherwise, it keeps the field unchanged.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kiran_panchavat_0-1739599634580.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34534i4555BF76CC2FC8D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kiran_panchavat_0-1739599634580.png" alt="kiran_panchavat_0-1739599634580.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2025 06:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711670#M240216</guid>
      <dc:creator>kiran_panchavat</dc:creator>
      <dc:date>2025-02-15T06:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711683#M240218</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval filtered=mvfilter(mvfield!="N/A")
| fillnull value="N/A" filtered&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 15 Feb 2025 10:38:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711683#M240218</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-02-15T10:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711692#M240219</link>
      <description>&lt;P&gt;What do you mean by "check"? Do you filter your initial results so that you have only those where field F contains at least two values of which one is 'N/A' and one isn't? Or do you want to do a conditional evaluation? (All other values which do not contain 'N/A' are left as they were).&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2025 11:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711692#M240219</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-02-15T11:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711722#M240221</link>
      <description>&lt;P&gt;Thnak you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, If I have a MV field with the values "red", "blue", "N/A", "N/A" I would want to filter out the "N/A" fields.&lt;BR /&gt;&lt;BR /&gt;However, if instead I have an MV field with the single value "red", then I would want it left alone&lt;/P&gt;&lt;P&gt;And third, if I have an MV field with the values "N/A", "N/A", and "N/A", then I would want it left alone.&lt;BR /&gt;&lt;BR /&gt;Only when there's a MV field with&amp;nbsp;&lt;EM&gt;both&lt;/EM&gt; the "N/A" field and a non-N/A&amp;nbsp; field do I want the N/A fields removed.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2025 16:54:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711722#M240221</guid>
      <dc:creator>dtaylor</dc:creator>
      <dc:date>2025-02-15T16:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711726#M240222</link>
      <description>&lt;P&gt;Your solution works perfectly. I still need to do some wider testing to make sure there's no gaps, but it looks like exactly what I need.....the only issue is....I'm not sure *exactly* what it works. I know what fillnull and eval do, but the way you've used mvfilter confuses me. If you have the time, could you explain in simple terms how your solution works, pelase?&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2025 18:19:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711726#M240222</guid>
      <dc:creator>dtaylor</dc:creator>
      <dc:date>2025-02-15T18:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711774#M240226</link>
      <description>&lt;P&gt;mvfilter() is indeed the way to go but you need to do a bit more bending over backwards to get it only when you need it.&lt;/P&gt;&lt;P&gt;A run-anywhere example:&lt;/P&gt;&lt;PRE&gt;| makeresults format=csv data="row&lt;BR /&gt;1;2;1;3&lt;BR /&gt;1;2;3;4&lt;BR /&gt;1;1;1;1&lt;BR /&gt;4;3;2;4;5&lt;BR /&gt;1;1;2;3&lt;BR /&gt;1;4;3;2&lt;BR /&gt;3;4;5;2&lt;BR /&gt;5;5;5&lt;BR /&gt;1;1"&lt;BR /&gt;| eval split=split(row,";")&lt;BR /&gt;``` This creates a set of example data```&lt;BR /&gt;| eval totalcount=mvcount(split)&lt;BR /&gt;``` This calculates how many elemets we have```&lt;BR /&gt;| eval onecount=mvcount(mvfilter(if(split="1",true(),false())))&lt;BR /&gt;``` This count how many ones we have```&lt;BR /&gt;| eval filtered=if(onecount&amp;gt;0 AND onecount&amp;lt;totalcount,mvfilter(if(split="1",false(),true())),split)&lt;BR /&gt;``` And this filters the ones but only if there was at least one (that's generally not needed) and there is less ones than all values ```&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Feb 2025 20:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711774#M240226</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-02-16T20:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Filter MV field for specified value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711775#M240227</link>
      <description>&lt;P&gt;The mvfunctions generally take an MV field as an input and then perform an operation on each of the values of the MV, so the solution&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval filtered=mvfilter(mvfield!="N/A")&lt;/LI-CODE&gt;&lt;P&gt;is saying&lt;/P&gt;&lt;P&gt;- for each value of the MV field called&amp;nbsp;&lt;STRONG&gt;mvfield&lt;/STRONG&gt; match each one against the string "N/A" and if it does NOT match (!="N/A") then return that value to the new field&amp;nbsp;&lt;STRONG&gt;filtered, &lt;/STRONG&gt;appending each non-matching value to that new field. That new field will then contain all the values of the original&amp;nbsp;&lt;STRONG&gt;mvfield&lt;/STRONG&gt; that did not match the string.&lt;/P&gt;&lt;P&gt;The eval is then finally putting back the "N/A" string to the &lt;STRONG&gt;filtered&lt;/STRONG&gt; field so that if ALL values of the original field contained N/A then the new field will have a single N/A value.&lt;/P&gt;&lt;P&gt;If you wanted ALL the N/A instances to be present, then replace the mvfilter line with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval filtered=coalesce(mvfilter(mvfield!="N/A"), mvfield)&lt;/LI-CODE&gt;&lt;P&gt;which if you have N/A 3 times in your original, you will have N/A 3 times in your final result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2025 22:11:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-MV-field-for-specified-value/m-p/711775#M240227</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2025-02-16T22:11:34Z</dc:date>
    </item>
  </channel>
</rss>

