<?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 Is it possible to remove values specified in a field from a list of values in another field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358691#M164112</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Given two list fields &lt;CODE&gt;add&lt;/CODE&gt; and &lt;CODE&gt;remove&lt;/CODE&gt;, as well as a &lt;CODE&gt;currentList&lt;/CODE&gt; list field, is it possible to create a new field&lt;CODE&gt;updatedList&lt;/CODE&gt;so that gets updated with &lt;CODE&gt;add&lt;/CODE&gt; values and without &lt;CODE&gt;remove&lt;/CODE&gt; values?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;add,remove,currentList,updatedList
value1,value2,value2 value3 value4, value1 value3 value4
value5,value3 value4,value1 value3 value4,value1 value5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any hints would be great!&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
    <pubDate>Thu, 28 Dec 2017 17:39:30 GMT</pubDate>
    <dc:creator>andrewtrobec</dc:creator>
    <dc:date>2017-12-28T17:39:30Z</dc:date>
    <item>
      <title>Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358691#M164112</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Given two list fields &lt;CODE&gt;add&lt;/CODE&gt; and &lt;CODE&gt;remove&lt;/CODE&gt;, as well as a &lt;CODE&gt;currentList&lt;/CODE&gt; list field, is it possible to create a new field&lt;CODE&gt;updatedList&lt;/CODE&gt;so that gets updated with &lt;CODE&gt;add&lt;/CODE&gt; values and without &lt;CODE&gt;remove&lt;/CODE&gt; values?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;add,remove,currentList,updatedList
value1,value2,value2 value3 value4, value1 value3 value4
value5,value3 value4,value1 value3 value4,value1 value5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any hints would be great!&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 17:39:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358691#M164112</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-28T17:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358692#M164113</link>
      <description>&lt;P&gt;Is field currentList multivalued field? Also, are add and remove multivalued field or single valued?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 19:22:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358692#M164113</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-28T19:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358693#M164114</link>
      <description>&lt;P&gt;currentList, add, and remove are all multivalue fields.  I've figured the add part out:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| eval currentList=mvdedup(mvappend(currentList, add))&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I just need to figure out the remove part.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 19:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358693#M164114</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-28T19:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358694#M164115</link>
      <description>&lt;P&gt;Unfortunately, there is no easy/direct way for removal from multivalued field. One method could be like this. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search with fields add, remove and currentList
| eval currentList=mvdedup(mvappend(currentList, add))
| nomv remove 
| streamstats count as sno
| mvexpand currentList
| where len(replace(remove,currentList,"")=len(remove)
| stats values(*) as * by sno | fields - sno
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Dec 2017 20:09:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358694#M164115</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-28T20:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358695#M164116</link>
      <description>&lt;P&gt;I've cut and pasted the code into my search but it doesn't seem to work, it just kinda messes up the fields.  I'll deconstruct the logic and play around with it.  Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 20:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358695#M164116</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-28T20:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358696#M164117</link>
      <description>&lt;P&gt;Here's a run-anywhere possibility:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval add="value1", remove="value2", current="value2 value3 value4"
| append [| makeresults | eval add="value5", remove="value3 value4", current="value1 value3 value4"]
| makemv add 
| makemv remove 
| makemv current
| eval current_plus_add=mvappend(add, current)
| streamstats window=1 current=t values(current_plus_add) AS distinct_current_plus_add, values(remove) AS distinct_remove
| eval distinct_current_plus_add_plus_distinct_remove=mvappend(distinct_current_plus_add, distinct_remove)
| streamstats count AS serial
| stats count BY distinct_current_plus_add_plus_distinct_remove serial
| search count=1
| stats list(distinct_current_plus_add_plus_distinct_remove) AS after_add_remove BY serial
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Dec 2017 21:05:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358696#M164117</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-12-28T21:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358697#M164118</link>
      <description>&lt;P&gt;Beautiful!  I hope that a future feature for multivalues will be &lt;CODE&gt;mvremove&lt;/CODE&gt; or something like that so we can easily remove values instead of tricky workarounds!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 23:14:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358697#M164118</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-12-28T23:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to remove values specified in a field from a list of values in another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358698#M164119</link>
      <description>&lt;P&gt;@andrewtrobec, you can create your own custom commands &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/Customsearchcommandshape"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Search/Customsearchcommandshape&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEU2"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEU2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 02:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-remove-values-specified-in-a-field-from-a-list/m-p/358698#M164119</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-29T02:46:21Z</dc:date>
    </item>
  </channel>
</rss>

