Other Usage

send an alert to appropriate responsible person

iswiau
Engager

Hello Friends,

My search returns the following:

serverName errorNumber responsiblePerson responsblePersonEmail
server_a4586Bob M.bobm@tmail.com
server_a1236Bob M.bobm@tmail.com
server_a788Bob M.bobm@tmail.com
server_b468Bob M.bobm@tmail.com
server_b8798Bob M.bobm@tmail.com
server_c5647Amelia S.amelias@tmail.com
server_c556Amelia S.amelias@tmail.com
server_c789Amelia S.amelias@tmail.com
server_c8799Amelia S.amelias@tmail.com

 

I want to send alerts by email to appropriate responsible person.

Each responsible person should receive ONLY ONE email that contain ALL errors on the servers for which he is responsible.

In this example Bob should receive one email that contain 5 lines (3 for server_a and 2 for server_b), and Amelia should receive one email that contain 4 lines (for server_c).

Any help would be appreciated!

 

 

Labels (3)
0 Karma
1 Solution

iswiau
Engager

Thank you for the quick answers.

The task assigned to me has changed
The customer wants to receive a separate email for each server.
This made solving the problem very simple  🙂

 

| stats values(*) as * by serverName

 

and than set the alert to trigger for each result.

Thank you very much!

View solution in original post

0 Karma

iswiau
Engager

Thank you for the quick answers.

The task assigned to me has changed
The customer wants to receive a separate email for each server.
This made solving the problem very simple  🙂

 

| stats values(*) as * by serverName

 

and than set the alert to trigger for each result.

Thank you very much!

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Use stats values() or stats list() to group events by recipient. Then use sendresults - https://splunkbase.splunk.com/app/1794

 

inventsekar
SplunkTrust
SplunkTrust

Hi @iswiau .. May we know, do you have only a small list of id's.. or a big list of people?

if you have only a small list of ids... you can use a if condition and select the email id. 

or, you can create a notepad file with the email ids and use map command like this..

... | outputcsv TempFile.csv
| stats values(Email_Address) AS emailToHeader | mvexpand emailToHeader
| map search ="|inputcsv TempFile.csv | where Email_Addresss=\"$emailToHeader$\"
   | fields - Email_Address
   | sendemail
      sendresults=true inline=true
      server=\"Your.Value.Here\"
      from=\"Your.Value.Here\"
      to=\"$emailToHeader$\"
      subject=\"Your Subject here: \$name\$\"
      message=\"This report alert was generated by \$app\$ Splunk with this search string: \$search\$\""
| where comment="MakeSureNoEventsRemail"
| append [|inputcsv TempFile.csv]

this above one is from this page

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
Get Updates on the Splunk Community!

Stay Connected: Your Guide to July Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...