<?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 get a comma separated List in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506749#M141760</link>
    <description>&lt;P&gt;| reverse | streamstats count | eval email=if(count&amp;gt;1,email+",",email) | fields - count | reverse&lt;/P&gt;&lt;P&gt;This is exactly what I needed.&amp;nbsp; Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2020 17:28:55 GMT</pubDate>
    <dc:creator>brownt61</dc:creator>
    <dc:date>2020-06-30T17:28:55Z</dc:date>
    <item>
      <title>How to get a comma separated List</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506695#M141748</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I am hoping for help creating a comma separated list.&amp;nbsp; I have tried multiple different things and all have resulted in lists, but never quite what I am needing.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of email addresses, that I need to be listed out, comma separated so that I can automate a currently manual process of updating a DLP policy.&lt;/P&gt;&lt;P&gt;The list would appear as follows&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;input data:&lt;/P&gt;&lt;P&gt;Email&lt;BR /&gt;&lt;A href="mailto:email1@email.com" target="_blank" rel="noopener"&gt;email1@email.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;email2@email.com&lt;/P&gt;&lt;P&gt;email3@email.com&lt;/P&gt;&lt;P&gt;email4@email.com&lt;/P&gt;&lt;P&gt;email5@email.com&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;email1124@email.com&lt;/P&gt;&lt;P&gt;email1125@email.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output list that I need comma separated needs to be displayed as follows&lt;/P&gt;&lt;P&gt;EmailAddress&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:email1@email.com" target="_blank" rel="noopener"&gt;email1@email.com,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;email2@email.com,&lt;/P&gt;&lt;P&gt;email3@email.com,&lt;/P&gt;&lt;P&gt;email4@email.com,&lt;/P&gt;&lt;P&gt;email5@email.com,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;email1124@email.com,&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:email1125@email.com" target="_blank" rel="noopener"&gt;email1125@email.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note that the list is comma separated however the final entry does not get a comma.&amp;nbsp; This is because Symantec DLP reconizes the comma separator as an expected new entry.&amp;nbsp; If there is no comma, the final entry is expected as the last entry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tied stats list (this worked) however, it limits the output to 100 (I have around 1500 email addresses).&amp;nbsp; I know that I could have the limits.conf increased from 100, but I would like to avoid this just do accomplish this one task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried to string the fields to string the , however it places the comma at the end of the final value in the list.&lt;BR /&gt;| eval EmailAddress=Email+","&lt;BR /&gt;| table EmailAddress&lt;/P&gt;&lt;P&gt;I have also tried mvjoin which just creates a giant mv field, which would be ok, expect some of the email addresses have a - in them, which then line breaks resulting in the .csv file being sent out break and have emails not formatted correctly.&lt;/P&gt;&lt;P&gt;I have also tried delim with a dc and values, however it also just creates a giant mv list with commas at the end of all values including the end value.&lt;/P&gt;&lt;P&gt;| stats delim="," dc(Email) as EmailAddressCount, values(Email) as EmailAddress&lt;BR /&gt;| nomv EmailAddress&lt;BR /&gt;| table EmailAddress&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Is there a way to create the comma separated list as requested? or is there an easier way to remove the trailing character from the LAST value?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 14:03:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506695#M141748</guid>
      <dc:creator>brownt61</dc:creator>
      <dc:date>2020-06-30T14:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a comma separated List</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506733#M141757</link>
      <description>&lt;P&gt;To generate the source data, I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| makeresults count=1500
| streamstats count
| eval email="email"+count+"@email.com"
| fields - _time, count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then to combine it, it used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| mvcombine email delim=","
| nomv email&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which results in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;email1@email.com,email2@email.com,email3@email.com,email4@email.com,email5@email.com,email6@email.com,emai....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, you can use the following to leave the email addresses in separate&amp;nbsp; events:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| reverse 
| streamstats count
| eval email=if(count&amp;gt;1,email+",",email)
| fields - count
| reverse&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which results in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;email1@email.com,
email2@email.com,
email3@email.com,
email4@email.com,
...
email1499@email.com,
email1500@email.com&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully one of those does what you're after?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 16:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506733#M141757</guid>
      <dc:creator>mthomas_splunk</dc:creator>
      <dc:date>2020-06-30T16:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a comma separated List</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506749#M141760</link>
      <description>&lt;P&gt;| reverse | streamstats count | eval email=if(count&amp;gt;1,email+",",email) | fields - count | reverse&lt;/P&gt;&lt;P&gt;This is exactly what I needed.&amp;nbsp; Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 17:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-comma-separated-List/m-p/506749#M141760</guid>
      <dc:creator>brownt61</dc:creator>
      <dc:date>2020-06-30T17:28:55Z</dc:date>
    </item>
  </channel>
</rss>

