<?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 send email to different groups based on the criteria? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374202#M109988</link>
    <description>&lt;P&gt;The &lt;A href="https://splunkbase.splunk.com/app/1794/"&gt;sendresults&lt;/A&gt; application should be a perfect fit for your scenario.&lt;/P&gt;</description>
    <pubDate>Sun, 25 Mar 2018 00:32:21 GMT</pubDate>
    <dc:creator>gjanders</dc:creator>
    <dc:date>2018-03-25T00:32:21Z</dc:date>
    <item>
      <title>How to send email to different groups based on the criteria?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374201#M109987</link>
      <description>&lt;P&gt;I would like to send emails to different groups based on number of events returned for a search. &lt;/P&gt;

&lt;P&gt;Query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xyz (host=server1) (sc_status=2*) (sc_status!=400*)  
| sort - _time 
| eval Time=strftime(_time, "%m/%d/%y %I:%M:%S %p") 
| eventstats count as TOTAL_COUNT 
| eval recipients = case(TOTAL_COUNT &amp;gt; 100, "qwerty1@abc.com,qwerty2@abc.com,qwerty3@abc.com", TOTAL_COUNT &amp;gt;= 50, "qwerty4@abc.com,qwerty5@abc.com,qwerty5@abc.com", 1==1, null()) 
| table Time,host,c_ip,cs_uri_stem,s_ip,s_port,sc_status,sc_substatus,time_taken
| sendemail to="qwerty1@abc.com,qwerty2@abc.com,qwerty3@abc.com" server=server subject="Here is an email notification" message="This is an example message" sendresults=true inline=true format=table sendpdf=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is working fine. But, I am not able to use the recipients custom field created based on the thresholds. I would like to use something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sendemail **to=$recipients$** server=server subject="Here is an email notification" message="This is an example message" sendresults=true inline=true format=table sendpdf=false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Mar 2018 19:35:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374201#M109987</guid>
      <dc:creator>kollachandra</dc:creator>
      <dc:date>2018-03-23T19:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to send email to different groups based on the criteria?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374202#M109988</link>
      <description>&lt;P&gt;The &lt;A href="https://splunkbase.splunk.com/app/1794/"&gt;sendresults&lt;/A&gt; application should be a perfect fit for your scenario.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 00:32:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374202#M109988</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2018-03-25T00:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to send email to different groups based on the criteria?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374203#M109989</link>
      <description>&lt;P&gt;Thank you for the help.&lt;/P&gt;

&lt;P&gt;Everything is good except that I am not able to define the subject of the alert dynamically. &lt;/P&gt;

&lt;P&gt;So, can you please let me know if there is a way I can remove the recipient field from the table of the alert and use $result.recipient$ in the to field of the alert.&lt;/P&gt;

&lt;P&gt;I am not be able to send the alert using $result.recipient$ but the only issue is if I mention it in the table it is chatty to read the alert. If I remove it by using | fields - recipient then the alert isn't being triggered to the corresponding recipients.&lt;/P&gt;

&lt;P&gt;Please help me.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 19:01:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-different-groups-based-on-the-criteria/m-p/374203#M109989</guid>
      <dc:creator>kollachandra</dc:creator>
      <dc:date>2018-04-17T19:01:10Z</dc:date>
    </item>
  </channel>
</rss>

