<?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: Trying to get the domain from multiple email recipients using rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330241#M98301</link>
    <description>&lt;P&gt;Here is what u can try&lt;/P&gt;

&lt;P&gt;1) If the data is not already extracted in a field extract it first in &lt;CODE&gt;shared_with&lt;/CODE&gt; field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysource
| rex "shared_with=\"(?&amp;lt;shared_with&amp;gt;[^\"]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) Next work on this field to extract all the domain names using rex iwth max_match=0&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=shared_with max_match=0 "(?&amp;lt;name&amp;gt;[^@]+)@(?&amp;lt;domain&amp;gt;[^,\"\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) Now you can choose fields name and domain the way you want, either to table it directly [it is a multivalue field]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table name, domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is complete query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysource
| rex "shared_with=\"(?&amp;lt;shared_with&amp;gt;[^\"]+)"
| rex field=shared_with max_match=0 "(?&amp;lt;name&amp;gt;[^@]+)@(?&amp;lt;domain&amp;gt;[^,\"\s]+)"
| table name, domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next you can use &lt;CODE&gt;mvexpand&lt;/CODE&gt; on &lt;CODE&gt;domain&lt;/CODE&gt; field to make the values individual field values rather than a multivalue field.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2018 23:46:19 GMT</pubDate>
    <dc:creator>gokadroid</dc:creator>
    <dc:date>2018-01-22T23:46:19Z</dc:date>
    <item>
      <title>Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330237#M98297</link>
      <description>&lt;P&gt;sourcetype=mysource | rex field=shared_with "(?P[A-Za-z0-9]+.[a-zA-Z]+)$"&lt;/P&gt;

&lt;P&gt;emails going to several different recipients and domains (google, yahoo, msn etc.)&lt;BR /&gt;
When I use this I get 1 result but not of the others. Someone recommended using a sed command to strip everything before the @ however I can seem to get it to work.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 20:22:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330237#M98297</guid>
      <dc:creator>Dallastek</dc:creator>
      <dc:date>2018-01-22T20:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330238#M98298</link>
      <description>&lt;P&gt;Could you provide some sample data please.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:27:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330238#M98298</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-01-22T21:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330239#M98299</link>
      <description>&lt;P&gt;Based on your sample code above, I'm guessing you have a field called &lt;CODE&gt;shared_with&lt;/CODE&gt;, and each instance of the field contains just a single email address. If so, this should work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysource
| rex field="shared_with" "@(?&amp;lt;domain&amp;gt;.*)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It just looks for the &lt;CODE&gt;@&lt;/CODE&gt; in the field and captures everything after it into a new field called &lt;CODE&gt;domain&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:47:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330239#M98299</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-01-22T21:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330240#M98300</link>
      <description>&lt;P&gt;Jan 22 20:06:12 ttjtsxj00 syslog[0233]: - - [Shirlene@2024 activity_type="Share" created_timestamp="2012-00-00D20:02:04" from_detect="0" inserted_timestamp="2012-00-00D20:02:09" instance="L006f51sf" object_type="File" service="secure" severity="informational" shared_with="&lt;A href="mailto:mark@diohnasypmxzjic.com" target="_blank"&gt;mark@diohnasypmxzjic.com&lt;/A&gt;, &lt;A href="mailto:bart@diohnasypmxzjic.com" target="_blank"&gt;bart@diohnasypmxzjic.com&lt;/A&gt;, &lt;A href="mailto:arat@toshiko.com" target="_blank"&gt;arat@toshiko.com&lt;/A&gt;, &lt;A href="mailto:ken.smith@toshiko.com" target="_blank"&gt;ken.smith@toshiko.com&lt;/A&gt;, &lt;A href="mailto:eva.@one.toshiko.com" target="_blank"&gt;eva.@one.toshiko.com&lt;/A&gt;, &lt;A href="mailto:randal@toshiko.com" target="_blank"&gt;randal@toshiko.com&lt;/A&gt;, &lt;A href="mailto:libby@wh.toshiko.com" target="_blank"&gt;libby@wh.toshiko.com&lt;/A&gt;, &lt;A href="mailto:azzie.hailey@one.toshiko.com" target="_blank"&gt;azzie.hailey@one.toshiko.com&lt;/A&gt;, &lt;A href="mailto:amy@diohnasypmxzjic.com" target="_blank"&gt;amy@diohnasypmxzjic.com&lt;/A&gt;, &lt;A href="mailto:loretta.mark@one.toshiko.com" target="_blank"&gt;loretta.mark@one.toshiko.com&lt;/A&gt;, &lt;A href="mailto:zenaida@one.toshiko.com" target="_blank"&gt;zenaida@one.toshiko.com&lt;/A&gt;, &lt;A href="mailto:cherrie@diohnasypmxzjic.com" target="_blank"&gt;cherrie@diohnasypmxzjic.com&lt;/A&gt;, &lt;A href="mailto:marcy@diohnasypmxzjic.com" target="_blank"&gt;marcy@diohnasypmxzjic.com&lt;/A&gt;, &lt;A href="mailto:genny@diohnasypmxzjic.com" target="_blank"&gt;genny@diohnasypmxzjic.com&lt;/A&gt;" source="KAY" user="&lt;A href="mailto:natalya.h.lisabeth@toshiko.com" target="_blank"&gt;natalya.h.lisabeth@toshiko.com&lt;/A&gt;"] User shared Deandrea document&lt;/P&gt;

&lt;P&gt;domain and user data has been randomized &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330240#M98300</guid>
      <dc:creator>Dallastek</dc:creator>
      <dc:date>2020-09-29T17:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330241#M98301</link>
      <description>&lt;P&gt;Here is what u can try&lt;/P&gt;

&lt;P&gt;1) If the data is not already extracted in a field extract it first in &lt;CODE&gt;shared_with&lt;/CODE&gt; field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysource
| rex "shared_with=\"(?&amp;lt;shared_with&amp;gt;[^\"]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) Next work on this field to extract all the domain names using rex iwth max_match=0&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=shared_with max_match=0 "(?&amp;lt;name&amp;gt;[^@]+)@(?&amp;lt;domain&amp;gt;[^,\"\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) Now you can choose fields name and domain the way you want, either to table it directly [it is a multivalue field]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table name, domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is complete query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysource
| rex "shared_with=\"(?&amp;lt;shared_with&amp;gt;[^\"]+)"
| rex field=shared_with max_match=0 "(?&amp;lt;name&amp;gt;[^@]+)@(?&amp;lt;domain&amp;gt;[^,\"\s]+)"
| table name, domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next you can use &lt;CODE&gt;mvexpand&lt;/CODE&gt; on &lt;CODE&gt;domain&lt;/CODE&gt; field to make the values individual field values rather than a multivalue field.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 23:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330241#M98301</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2018-01-22T23:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330242#M98302</link>
      <description>&lt;P&gt;Slight variation to your 2nd &lt;CODE&gt;rex&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex max_match=0 field=shared_with "(^|, )(?&amp;lt;name&amp;gt;[^@ ]+)@(?&amp;lt;domain&amp;gt;[^,]+)(,|$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Prevents getting &lt;CODE&gt;,&lt;/CODE&gt; as a prefix to &lt;CODE&gt;name&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 04:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330242#M98302</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-23T04:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330243#M98303</link>
      <description>&lt;P&gt;Thanks gokadroid, I made a couple of adjustments and it is working great, thanks!&lt;BR /&gt;
index=mine shared_with=&lt;EM&gt;@&lt;/EM&gt;&lt;BR /&gt;
| rex max_match=0 field=shared_with "(^|, )(?[^@ ]+)@(?[^,]+)(,|$)" | table name, domain&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:49:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330243#M98303</guid>
      <dc:creator>Dallastek</dc:creator>
      <dc:date>2020-09-29T17:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get the domain from multiple email recipients using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330244#M98304</link>
      <description>&lt;P&gt;Awesome...happy to have helped.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 14:27:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-get-the-domain-from-multiple-email-recipients-using/m-p/330244#M98304</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2018-01-23T14:27:16Z</dc:date>
    </item>
  </channel>
</rss>

