<?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: Using a lookup to send multiple different emails in an alert in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484106#M8563</link>
    <description>&lt;P&gt;Hi @djemodjenai&lt;/P&gt;

&lt;P&gt;Try piping the current search that you have into this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(min_use_rate) as min_use_rate values(threshold) as threshold by host, mail
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think this should break down your results so you have one row per host and mail combination.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2020 20:01:34 GMT</pubDate>
    <dc:creator>acfecondo75</dc:creator>
    <dc:date>2020-01-16T20:01:34Z</dc:date>
    <item>
      <title>Using a lookup to send multiple different emails in an alert</title>
      <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484105#M8562</link>
      <description>&lt;P&gt;I am using a lookup with a list of hosts, thresholds an email addresses to dynamically send  email alerts when a threshold is hit.&lt;/P&gt;

&lt;P&gt;It works well when there is a simple mapping:&lt;BR /&gt;
host1 email1&lt;BR /&gt;
host2 email1&lt;/P&gt;

&lt;P&gt;But it's not working when it's:&lt;/P&gt;

&lt;P&gt;host1 email1&lt;BR /&gt;
host1 email2&lt;/P&gt;

&lt;P&gt;The lookup looks like this:&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/280709-lookup.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;My search is:&lt;/P&gt;

&lt;P&gt;(mysearch calculating a rate)&lt;BR /&gt;
| stats min(rate) as min_rate by host&lt;BR /&gt;
| lookup mylookup.csv host OUTPUT threshold mail&lt;BR /&gt;
| where min_rate &amp;gt; threshold | fields host min_rate mail threshold&lt;/P&gt;

&lt;P&gt;Then, it sends an email using $result.mail$ within the savedsearches parameters (alert).&lt;/P&gt;

&lt;P&gt;The problem is that it groups the results with host1 -&amp;gt; list of emails, hence it fails to separate the different email adresses as $result.mail$.&lt;IMG src="https://community.splunk.com/storage/temp/280708-problem.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;The result looks like this:&lt;BR /&gt;
host1      email1.com&lt;BR /&gt;
--------     email2.com&lt;/P&gt;

&lt;P&gt;Instead of this:&lt;BR /&gt;
host1     email1.com&lt;BR /&gt;
host1     email2.com&lt;/P&gt;

&lt;P&gt;It's probably because of the "by host" in my search, is there a way to make the results "for each"?&lt;/P&gt;

&lt;P&gt;Can anyone help me?&lt;BR /&gt;
I tried playing with the lookup parameters, but I'm stuck... Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:40:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484105#M8562</guid>
      <dc:creator>djemodjenai</dc:creator>
      <dc:date>2020-09-30T03:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup to send multiple different emails in an alert</title>
      <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484106#M8563</link>
      <description>&lt;P&gt;Hi @djemodjenai&lt;/P&gt;

&lt;P&gt;Try piping the current search that you have into this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(min_use_rate) as min_use_rate values(threshold) as threshold by host, mail
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think this should break down your results so you have one row per host and mail combination.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484106#M8563</guid>
      <dc:creator>acfecondo75</dc:creator>
      <dc:date>2020-01-16T20:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup to send multiple different emails in an alert</title>
      <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484107#M8564</link>
      <description>&lt;P&gt;I see what you are trying to do, but there are no threshold nor mail in the initial query. They are brought up with the lookup, so it doesn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:27:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484107#M8564</guid>
      <dc:creator>djemodjenai</dc:creator>
      <dc:date>2020-01-16T20:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup to send multiple different emails in an alert</title>
      <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484108#M8565</link>
      <description>&lt;P&gt;Yeah so you do it at the end after you've run the lookup to add those fields...&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:29:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484108#M8565</guid>
      <dc:creator>acfecondo75</dc:creator>
      <dc:date>2020-01-16T20:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup to send multiple different emails in an alert</title>
      <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484109#M8566</link>
      <description>&lt;P&gt;If that doesn't work, you can do &lt;BR /&gt;
&lt;CODE&gt;| mvexpand mail&lt;/CODE&gt;&lt;BR /&gt;
this should create an individual row entry for each value in the mail field. &lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484109#M8566</guid>
      <dc:creator>acfecondo75</dc:creator>
      <dc:date>2020-01-16T20:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using a lookup to send multiple different emails in an alert</title>
      <link>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484110#M8567</link>
      <description>&lt;P&gt;You're right, it works when I pipe after the lookup. I changed your suggestion a little bit to make it work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysearch] |mylookup.csv host OUTPUT threshold mail
| stats min(use_rate) as min_use_rate values(threshold) as threshold by host, mail
| where min_use_rate &amp;gt; threshold | fields host min_use_rate mail threshold
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It separates the result as wanted. Now I have to test it IRL.&lt;/P&gt;

&lt;P&gt;This is brilliant, thank you @acfecondo75 for your time!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 07:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Using-a-lookup-to-send-multiple-different-emails-in-an-alert/m-p/484110#M8567</guid>
      <dc:creator>djemodjenai</dc:creator>
      <dc:date>2020-01-17T07:28:00Z</dc:date>
    </item>
  </channel>
</rss>

