<?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 do I combine unique values of a field into one for multiple fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415100#M174345</link>
    <description>&lt;P&gt;I am trying to make a report with the unique combination of ID, AVER SRV, ZONE, IPADDR &amp;amp; host. Unfortunately, I am getting lots of duplicate values because I have multiple values for ZONE, IPADDR &amp;amp; host. Currently, I am using 3 different queries in Splunk and joining the table with SRV later. However, is there anyway I can combine multiple values of those fields in one field each so I won't have lots of duplication.&lt;/P&gt;

&lt;P&gt;Currently I am using the following query:&lt;BR /&gt;
I have a query that re&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*prod*
| dedup SRV AVER ZONE  
| fields + SRV , IVER, AVER, ZONE 
| stats values(ZONE) as ZONE by SRV AVER  
| nomv ZONE 
| eval ZONE=replace(ZONE,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*prod*
| dedup SRV IPADDR
| fields +  SRV IPADDR
| stats values(IPADDR) as IPADDR by SRV 
| nomv IPADDR 
| eval IPADDR =replace(IPADDR ,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*prod*
| dedup SRV host
| fields + SRV , host
| stats values(host) as host by SRV 
| nomv host 
| eval host=replace(host,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Nov 2018 23:17:26 GMT</pubDate>
    <dc:creator>srizan</dc:creator>
    <dc:date>2018-11-29T23:17:26Z</dc:date>
    <item>
      <title>How do I combine unique values of a field into one for multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415100#M174345</link>
      <description>&lt;P&gt;I am trying to make a report with the unique combination of ID, AVER SRV, ZONE, IPADDR &amp;amp; host. Unfortunately, I am getting lots of duplicate values because I have multiple values for ZONE, IPADDR &amp;amp; host. Currently, I am using 3 different queries in Splunk and joining the table with SRV later. However, is there anyway I can combine multiple values of those fields in one field each so I won't have lots of duplication.&lt;/P&gt;

&lt;P&gt;Currently I am using the following query:&lt;BR /&gt;
I have a query that re&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*prod*
| dedup SRV AVER ZONE  
| fields + SRV , IVER, AVER, ZONE 
| stats values(ZONE) as ZONE by SRV AVER  
| nomv ZONE 
| eval ZONE=replace(ZONE,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*prod*
| dedup SRV IPADDR
| fields +  SRV IPADDR
| stats values(IPADDR) as IPADDR by SRV 
| nomv IPADDR 
| eval IPADDR =replace(IPADDR ,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*prod*
| dedup SRV host
| fields + SRV , host
| stats values(host) as host by SRV 
| nomv host 
| eval host=replace(host,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 23:17:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415100#M174345</guid>
      <dc:creator>srizan</dc:creator>
      <dc:date>2018-11-29T23:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine unique values of a field into one for multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415101#M174346</link>
      <description>&lt;P&gt;So far I was able to combine 2 of those into one stats, introducing third value(X) as X would not yeild the last field in the final result. Here is what the query looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source=*prod*
| dedup SRV AVER ZONE  
| fields + SRV , IVER, AVER, ZONE 
| stats values(ZONE) as ZONE values(IPADDR) as IPADDR by SRV AVER  
| nomv ZONE 
| eval ZONE=replace(ZONE,"\s",",")
| nomv IPADDR 
| eval IPADDR =replace(IPADDR ,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 15:01:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415101#M174346</guid>
      <dc:creator>srizan</dc:creator>
      <dc:date>2018-11-30T15:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine unique values of a field into one for multiple fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415102#M174347</link>
      <description>&lt;P&gt;Surprisingly it worked after I switched values(IPADDR ) at the end.&lt;BR /&gt;
Before I was doing the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    source=*prod*
     | dedup SRV AVER ZONE  
     | fields + SRV , IVER, AVER, ZONE 
     | stats values(ZONE) as ZONE, values(IPADDR) as IPADDR, values(host) as host by SRV AVER  
     | nomv ZONE 
     | eval ZONE=replace(ZONE,"\s",",")
     | nomv IPADDR 
     | eval IPADDR =replace(IPADDR ,"\s",",") 
     | nomv host 
     | eval host=replace(host,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It worked after I switched place between host &amp;amp; IPADDR:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  source=*prod*
 | dedup SRV AVER ZONE  
 | fields + SRV , IVER, AVER, ZONE 
 | stats values(ZONE) as ZONE, values(host) as host,  values(IPADDR) as IPADDR by SRV AVER  
 | nomv ZONE 
 | eval ZONE=replace(ZONE,"\s",",")
 | nomv host 
 | eval host=replace(host,"\s",",")
 | nomv IPADDR 
 | eval IPADDR =replace(IPADDR ,"\s",",")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am not sure why did this happen? Can anyone explain me the difference, and why it might not have worked. BTW, when I tried the first command, it did not even show the host field at all in the final output.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 15:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-unique-values-of-a-field-into-one-for-multiple/m-p/415102#M174347</guid>
      <dc:creator>srizan</dc:creator>
      <dc:date>2018-11-30T15:10:29Z</dc:date>
    </item>
  </channel>
</rss>

