<?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: Multi-value field how to match condition in case statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405047#M171923</link>
    <description>&lt;P&gt;@niketnilay    Do I have to convert multiple values to single values?&lt;/P&gt;</description>
    <pubDate>Thu, 11 Apr 2019 07:43:52 GMT</pubDate>
    <dc:creator>bestSplunker</dc:creator>
    <dc:date>2019-04-11T07:43:52Z</dc:date>
    <item>
      <title>Multi-value field how to match condition in case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405045#M171921</link>
      <description>&lt;P&gt;hello everyone&lt;/P&gt;

&lt;P&gt;I am analyzing the mail tracking log for Exchange.I divide the type of sendemail  into 3 types.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;@abc.com&lt;/CODE&gt;  is my is our internal email domain name, &lt;CODE&gt;recipient&lt;/CODE&gt; field is  the recipient of the email, either a single-valued field or a multi-valued field.I want to use the case statement to achieve the following conditional judgments. &lt;CODE&gt;src_user&lt;/CODE&gt; is the sender of the email, it is always a single value field&lt;/P&gt;

&lt;P&gt;if  recipient contain &lt;CODE&gt;@abc.com&lt;/CODE&gt; (for example:  &lt;A href="mailto:abc@abc.com"&gt;abc@abc.com&lt;/A&gt;   or  &lt;A href="mailto:test@abc.com"&gt;test@abc.com&lt;/A&gt;;&lt;A href="mailto:admin@abc.com"&gt;admin@abc.com&lt;/A&gt;)  email domain  then  action is  &lt;CODE&gt;sendemail to internal&lt;/CODE&gt;&lt;BR /&gt;
if recipient   not contain &lt;CODE&gt;@abc.com&lt;/CODE&gt;  (for example:  &lt;A href="mailto:test@google.com"&gt;test@google.com&lt;/A&gt;   or  &lt;A href="mailto:test@google.com"&gt;test@google.com&lt;/A&gt;;&lt;A href="mailto:admin@yahoo.com"&gt;admin@yahoo.com&lt;/A&gt;)    then  action is  &lt;CODE&gt;sendemail to external&lt;/CODE&gt;&lt;BR /&gt;
if  recipient   contain  &lt;CODE&gt;@abc.com&lt;/CODE&gt;  or  include a domain name other than &lt;CODE&gt;@abc.com&lt;/CODE&gt;  (for example:  &lt;A href="mailto:test@abc.com"&gt;test@abc.com&lt;/A&gt; ; &lt;A href="mailto:admin@google.com"&gt;admin@google.com&lt;/A&gt;) then action is  &lt;CODE&gt;sendemail to internal and external&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;At the same time, I hope it supports a comprehensive judgment of multiple conditions.&lt;/P&gt;

&lt;P&gt;for example &lt;/P&gt;

&lt;P&gt;if  &lt;CODE&gt;src_user = "*@abc.com"&lt;/CODE&gt;  and  recipient contain &lt;CODE&gt;@abc.com&lt;/CODE&gt;   then    action is   &lt;CODE&gt;sendemail from internal  to internal&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;So I don't know how to match multivalued fields. I tried to use &lt;CODE&gt;LIKE&lt;/CODE&gt; and &lt;CODE&gt;=&lt;/CODE&gt;  not working properly&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/6853iFE01581BCA71AA4C/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>Thu, 11 Apr 2019 06:21:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405045#M171921</guid>
      <dc:creator>bestSplunker</dc:creator>
      <dc:date>2019-04-11T06:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-value field how to match condition in case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405046#M171922</link>
      <description>&lt;P&gt;@bestSplunker pipe the following to your existing search results to break each multivalue field to separate event as separate row &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mvexpand recipent
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can add logic to forward to internal and external as per your logic. Please let us know if you need help with this logic as well. Or something does not work!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 07:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405046#M171922</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-04-11T07:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-value field how to match condition in case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405047#M171923</link>
      <description>&lt;P&gt;@niketnilay    Do I have to convert multiple values to single values?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 07:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405047#M171923</guid>
      <dc:creator>bestSplunker</dc:creator>
      <dc:date>2019-04-11T07:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-value field how to match condition in case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405048#M171924</link>
      <description>&lt;P&gt;Here is an example solution: (first line is only generating your sample input to have it run as a cut and paste example)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval recipient="abc@abc.com%abc@abc.com,test@abc.com%google@google.com%google@google.com,yahoo@yahoo.com%abc@abc.com,google@google.com" | makemv delim="%" recipient | mvexpand recipient | makemv delim="," recipient
| eval no_rec=mvcount(recipient), no_match=mvcount(mvfilter(match(recipient, "@abc\.com$")))
| eval action=case(no_match=no_rec, "sendemail to internal", no_match&amp;lt;no_rec, "sendemail to internal and external", true(), "sendemail to external")
| table recipient, action
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hth,&lt;BR /&gt;
-Kai.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 07:47:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405048#M171924</guid>
      <dc:creator>knielsen</dc:creator>
      <dc:date>2019-04-11T07:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-value field how to match condition in case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405049#M171925</link>
      <description>&lt;P&gt;thank you!  You're awesome!!!!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 09:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-field-how-to-match-condition-in-case-statement/m-p/405049#M171925</guid>
      <dc:creator>bestSplunker</dc:creator>
      <dc:date>2019-04-11T09:25:58Z</dc:date>
    </item>
  </channel>
</rss>

