<?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: String split to the same field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289278#M87532</link>
    <description>&lt;P&gt;What to do is going to depend on what you want with all those timecharts.  &lt;/P&gt;

&lt;P&gt;If you don't want to look at timechart for all the recipients, then put into words what you DO want to look at.  &lt;/P&gt;

&lt;P&gt;I suspect that you could use mvexpand to create a single record for each person for each email, then use stats (not timechart)  against a binned _time field to roll them all together, then from that, select which persons you want to analyse.  For example, something like the following would give you timecharts for the top 5 recipients who received the most emails. (air code)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your base search 
| eval recipient=split(recipients,";") 
| mvexpand recipient 
| bin _time span=1d
| stats count as rdcount by recipient _time
| appendpipe [| stats sum(rdcount) as ecount by recipient | top 5 ecount ]
| eventstats max(ecount) as ecount by recipient
| where isnotnull(ecount) 
| timechart span=1d sum(rdcount) as count by recipient 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 27 Mar 2017 15:46:58 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-03-27T15:46:58Z</dc:date>
    <item>
      <title>String split to the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289276#M87530</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am doing some email count analysis and run into the following problem. &lt;BR /&gt;
For inbound email the recipients field contains a string of email addresses(it could be few or hundreds of addresses) each separated by ";". &lt;/P&gt;

&lt;P&gt;Using &lt;CODE&gt;eval recipient=split(recipients,";")&lt;/CODE&gt; I am able to split them but they are all split into a single field recipient which contains multiple values. &lt;/P&gt;

&lt;P&gt;I want to do &lt;CODE&gt;...|search recipient="abc@abc.com" | timechart span=1d by recipient&lt;/CODE&gt; however the search returns timechart for ALL users in the receipent field. &lt;/P&gt;

&lt;P&gt;I was thinking about using regex but I do not know how many fields to extract based on various number of recipients for each email message.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 14:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289276#M87530</guid>
      <dc:creator>ttchorz</dc:creator>
      <dc:date>2017-03-27T14:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: String split to the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289277#M87531</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;mvexpand&lt;/CODE&gt; command to convert each recipient into single row. Use it after your &lt;CODE&gt;eval -split&lt;/CODE&gt; command. So it'll be like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval recipient=split(recipients,";") | mvexpand recipient |search recipient="abc@abc.com" | timechart span=1d count by recipient
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Mar 2017 14:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289277#M87531</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-27T14:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: String split to the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289278#M87532</link>
      <description>&lt;P&gt;What to do is going to depend on what you want with all those timecharts.  &lt;/P&gt;

&lt;P&gt;If you don't want to look at timechart for all the recipients, then put into words what you DO want to look at.  &lt;/P&gt;

&lt;P&gt;I suspect that you could use mvexpand to create a single record for each person for each email, then use stats (not timechart)  against a binned _time field to roll them all together, then from that, select which persons you want to analyse.  For example, something like the following would give you timecharts for the top 5 recipients who received the most emails. (air code)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your base search 
| eval recipient=split(recipients,";") 
| mvexpand recipient 
| bin _time span=1d
| stats count as rdcount by recipient _time
| appendpipe [| stats sum(rdcount) as ecount by recipient | top 5 ecount ]
| eventstats max(ecount) as ecount by recipient
| where isnotnull(ecount) 
| timechart span=1d sum(rdcount) as count by recipient 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Mar 2017 15:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289278#M87532</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-27T15:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: String split to the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289279#M87533</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;mvexpand recipient
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;worked exactly how I was expecting the results to be. Thanks all for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 17:56:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/String-split-to-the-same-field/m-p/289279#M87533</guid>
      <dc:creator>ttchorz</dc:creator>
      <dc:date>2017-03-27T17:56:24Z</dc:date>
    </item>
  </channel>
</rss>

