Alerting

How to generate multiple alert email based on 2 conditions?

Roopaul
Explorer

Hi,

I have a requirement to generate alerts every 15 mins if a particular condition occurs. Then I need to group data from a few server in one alert and data from other set of server in another alert.
srvrA - srvr1,srvr2
srvrB - srvr3,srvr4,srvr5

Email for srvrA:
fieldA | field B | _raw
A1 | B1 | Event1
A1 | B2 | Event2

Email for srvrB:
fieldA | fieldB | _raw
A3 | B3 | Event1
A1 | B3 | Event2

Could you please help me how to use the condition from same query and send 2 different emails.

0 Karma

nunoaragao
Path Finder

If you add the recipients on a new column, you can configure the alert to send to $results.recipient$, and must set the alert to process a new email for each result. You can even aggregate the results with values() or list() so that each recipient only receives one alert. ( Tested on 6.5.x )

stats values(fieldA) values(fieldB) values(_raw) by recipient

fieldA | field B | _raw | recipient
A1 | B1 | Event1 | ServersA@xxx.xx
A1 | B2 | Event2 |
A3 | B3 | Event1 | ServersB@xxx.xx
A1 | B3 | Event2 |

on savedsearches.conf :
action.email.to = $result.recipient$
alert.digest_mode = 0

0 Karma

jhall_101215
Explorer

Not sure if this is what you were aiming for but martin had a good suggestion here: https://answers.splunk.com/answers/499889/send-emails-to-users-based-on-different-condtions.html

c_krishna_gutur
Explorer

@Roopal: Even i got similar kind of requirement, did u find any solution for sending multiple alerts?

0 Karma

sundareshr
Legend

Create two alerts, both to run every 15mins looking for similar conditions to occur. Example

*Alert 1*
host=srvr1 OR host=srvr2 | stats count on alertcondition

*Alert 2*
host=srvr3 OR host=srvr4 OR host=srvr5 | stats count on alertcondition

Then setup alerts for each of these searches.

0 Karma

Roopaul
Explorer

Thanks sundareshr.

Yes, I am aware of it that 2 different alerts can be created. But i would like to know if there is a way this can be handled in a single alert or single saved search.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...