<?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 display unique values only from one particular multi-value field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201997#M58577</link>
    <description>&lt;P&gt;Option with stats values (Assuming there is _raw field in your data &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here
| rex field=msg "^(?&amp;lt;msg_text&amp;gt;.+?)(?&amp;lt;msg_numbers&amp;gt;[\d\,]+)$"
| eval msg_numbers = split(msg_numbers, ",")
| mvexpand msg_numbers
| stats values(msg_numbers) as msg_numbers by _raw, msg_text
| eval msg_numbers = mvjoin(msg_numbers, ",")
| eval msg = msg_text . msg_numbers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another option with mvdedup:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here
| rex field=msg "^(?&amp;lt;msg_text&amp;gt;.+?)(?&amp;lt;msg_numbers&amp;gt;[\d\,]+)$"
| eval msg_numbers = mvjoin(mvdedup(split(msg_numbers, ",")), ",")
| eval msg = msg_text . msg_numbers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | fields - count
| eval _raw = "_time=2016-12-18 00:00:00 this is from: 101,102,103,101,104,102,103,105,106"
| eval msg = "this is from: 101,102,103,101,104,102,103,105,106"
| rex field=msg "^(?&amp;lt;msg_text&amp;gt;.+?)(?&amp;lt;msg_numbers&amp;gt;[\d\,]+)$"
| eval msg_numbers = split(msg_numbers, ",")
| mvexpand msg_numbers
| stats values(msg_numbers) as msg_numbers by _raw, msg_text
| eval msg_numbers = mvjoin(msg_numbers, ",")
| eval msg = msg_text . msg_numbers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output (see picture below):&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2264iC734475ABF020F35/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 12:05:40 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-12-19T12:05:40Z</dc:date>
    <item>
      <title>how to display unique values only from one particular multi-value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201995#M58575</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
i have a field like &lt;CODE&gt;msg="this is from: 101,102,103,101,104,102,103,105,106"&lt;/CODE&gt; but i would like to display that field with unique numbers only, without duplicates, like this &lt;CODE&gt;msg="this is from: 101,102,103,104,105,106"&lt;/CODE&gt; using a search query &lt;BR /&gt;
Please help!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 11:24:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201995#M58575</guid>
      <dc:creator>Umesh_Vedicsoft</dc:creator>
      <dc:date>2016-12-19T11:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to display unique values only from one particular multi-value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201996#M58576</link>
      <description>&lt;P&gt;Hi there, &lt;/P&gt;

&lt;P&gt;maybe the eval-statement mvdedup is what you are looking for. &lt;/P&gt;

&lt;P&gt;You can just execute the query below as an example: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval msg="this is from: 101,102,103,101,104,102,103,105,106" | rex max_match=99 field=msg "(?&amp;lt;msg_from&amp;gt;\d+" | eval u_msg_from=mvdedup(msg_from)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Greetings&lt;BR /&gt;
hgrow&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201996#M58576</guid>
      <dc:creator>hgrow</dc:creator>
      <dc:date>2016-12-19T12:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to display unique values only from one particular multi-value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201997#M58577</link>
      <description>&lt;P&gt;Option with stats values (Assuming there is _raw field in your data &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here
| rex field=msg "^(?&amp;lt;msg_text&amp;gt;.+?)(?&amp;lt;msg_numbers&amp;gt;[\d\,]+)$"
| eval msg_numbers = split(msg_numbers, ",")
| mvexpand msg_numbers
| stats values(msg_numbers) as msg_numbers by _raw, msg_text
| eval msg_numbers = mvjoin(msg_numbers, ",")
| eval msg = msg_text . msg_numbers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another option with mvdedup:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here
| rex field=msg "^(?&amp;lt;msg_text&amp;gt;.+?)(?&amp;lt;msg_numbers&amp;gt;[\d\,]+)$"
| eval msg_numbers = mvjoin(mvdedup(split(msg_numbers, ",")), ",")
| eval msg = msg_text . msg_numbers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | fields - count
| eval _raw = "_time=2016-12-18 00:00:00 this is from: 101,102,103,101,104,102,103,105,106"
| eval msg = "this is from: 101,102,103,101,104,102,103,105,106"
| rex field=msg "^(?&amp;lt;msg_text&amp;gt;.+?)(?&amp;lt;msg_numbers&amp;gt;[\d\,]+)$"
| eval msg_numbers = split(msg_numbers, ",")
| mvexpand msg_numbers
| stats values(msg_numbers) as msg_numbers by _raw, msg_text
| eval msg_numbers = mvjoin(msg_numbers, ",")
| eval msg = msg_text . msg_numbers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output (see picture below):&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2264iC734475ABF020F35/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201997#M58577</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-12-19T12:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to display unique values only from one particular multi-value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201998#M58578</link>
      <description>&lt;P&gt;insert in your search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=msg "(?&amp;lt;a&amp;gt;\d+)" max_match=10 
| mvexpand a 
| dedup a 
| mvcombine delim=", " a 
| nomv a 
| eval msg="this is from: "+a 
| table msg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:07:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201998#M58578</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-12-19T12:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to display unique values only from one particular multi-value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201999#M58579</link>
      <description>&lt;P&gt;Or, if you are certain the original field has only this format, something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=msg "^this is from: (?P&amp;lt;msg_from&amp;gt;.*)$" | eval msg_from=split(msg_from, ",") | eval msg_from=mvdedup(msg_from) | eval msg_from=mvjoin(msg_from, ",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure which way is more efficient - rex with max_match or split, but it is always nice to have more than one way of doing things.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-unique-values-only-from-one-particular-multi/m-p/201999#M58579</guid>
      <dc:creator>arkadyz1</dc:creator>
      <dc:date>2016-12-19T14:15:23Z</dc:date>
    </item>
  </channel>
</rss>

