<?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 Creating a List of Email Addresses and performing a search loop in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Creating-a-List-of-Email-Addresses-and-performing-a-search-loop/m-p/441111#M7124</link>
    <description>&lt;P&gt;Pretty new to Splunk and looking for advice. &lt;BR /&gt;
I’ve tried reviewing subsearches, map and foreach looping but I just can’t crack the syntax.&lt;BR /&gt;
I have two indexes, one that stores computer hostname, ip, and a tag for a contact email.&lt;BR /&gt;
The other index is scan data regarding missing patches by ip&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=hostnames 
Hostname     ip_address Contact
Hostname1  192.x.x.1     Email1
Hostname2  192.x.x.2     Email2
Hostname3  192.x.x.3     Email3
Hostname4  192.x.x.4     Email4
Hostname5  192.x.x.5     Email2
Hostname6  192.x.x.6     Email3

Index=scandata
Ip             scanfindingname    scanfindingdescription
192.x.x.4   java-blah                   java-blah
192.x.x.2   java-blah                   java-blah
192.x.x.2   java-blah2                 java-blah2 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have figured out how to get the search with a join ip to ip_address to display a table with a stats count hostname, ip, and contact email to show the hostname and total amount of findings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Table where Contact=Email2:
Hostname       IP                   Contact       Count
Hostname2     192.x.x.2           Email2         2
Hostname5     192.x.x.5           Email2         1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I cannot figure out how to create an automated email for each email address from the hostnames index.&lt;BR /&gt;
It's essentially 3 queries.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Get list of email addresses from contact field in hostname index (dedup contact) [Email1, Email2, Email3]&lt;/LI&gt;
&lt;LI&gt;Find Scan data by ip and grab the hostname and total found by hostname where contact = $Email$&lt;/LI&gt;
&lt;LI&gt;Email table to $Email$
Any advice is appreciated.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Fri, 31 Aug 2018 17:37:23 GMT</pubDate>
    <dc:creator>ShawnWarner7</dc:creator>
    <dc:date>2018-08-31T17:37:23Z</dc:date>
    <item>
      <title>Creating a List of Email Addresses and performing a search loop</title>
      <link>https://community.splunk.com/t5/Reporting/Creating-a-List-of-Email-Addresses-and-performing-a-search-loop/m-p/441111#M7124</link>
      <description>&lt;P&gt;Pretty new to Splunk and looking for advice. &lt;BR /&gt;
I’ve tried reviewing subsearches, map and foreach looping but I just can’t crack the syntax.&lt;BR /&gt;
I have two indexes, one that stores computer hostname, ip, and a tag for a contact email.&lt;BR /&gt;
The other index is scan data regarding missing patches by ip&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=hostnames 
Hostname     ip_address Contact
Hostname1  192.x.x.1     Email1
Hostname2  192.x.x.2     Email2
Hostname3  192.x.x.3     Email3
Hostname4  192.x.x.4     Email4
Hostname5  192.x.x.5     Email2
Hostname6  192.x.x.6     Email3

Index=scandata
Ip             scanfindingname    scanfindingdescription
192.x.x.4   java-blah                   java-blah
192.x.x.2   java-blah                   java-blah
192.x.x.2   java-blah2                 java-blah2 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have figured out how to get the search with a join ip to ip_address to display a table with a stats count hostname, ip, and contact email to show the hostname and total amount of findings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Table where Contact=Email2:
Hostname       IP                   Contact       Count
Hostname2     192.x.x.2           Email2         2
Hostname5     192.x.x.5           Email2         1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I cannot figure out how to create an automated email for each email address from the hostnames index.&lt;BR /&gt;
It's essentially 3 queries.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Get list of email addresses from contact field in hostname index (dedup contact) [Email1, Email2, Email3]&lt;/LI&gt;
&lt;LI&gt;Find Scan data by ip and grab the hostname and total found by hostname where contact = $Email$&lt;/LI&gt;
&lt;LI&gt;Email table to $Email$
Any advice is appreciated.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 31 Aug 2018 17:37:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Creating-a-List-of-Email-Addresses-and-performing-a-search-loop/m-p/441111#M7124</guid>
      <dc:creator>ShawnWarner7</dc:creator>
      <dc:date>2018-08-31T17:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a List of Email Addresses and performing a search loop</title>
      <link>https://community.splunk.com/t5/Reporting/Creating-a-List-of-Email-Addresses-and-performing-a-search-loop/m-p/441112#M7125</link>
      <description>&lt;P&gt;Hi @ShawnWarner7, &lt;/P&gt;

&lt;P&gt;so you mean you want to create an alert that sends out an email to an email address that was found in the events. &lt;BR /&gt;
Interesting approach, not sure if it works, but you could set the alert trigger conditions to "for each event" and try to set an "send email" alert action. &lt;/P&gt;

&lt;P&gt;You could then try to write the following in the email field:&lt;/P&gt;

&lt;P&gt;$results.Email$&lt;/P&gt;

&lt;P&gt;Maybe that works? &lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 19:02:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Creating-a-List-of-Email-Addresses-and-performing-a-search-loop/m-p/441112#M7125</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-31T19:02:29Z</dc:date>
    </item>
  </channel>
</rss>

