I ussing watcher for monitor User login to server. If have new login send email alert to user and admin server ( have already file username, clientip, ssh)
I have question.
For example, my input in watcher matched with 20 total hit.
How to send email to 20 user ? or another case , have 25 total hit matched , how to send email to 25 user ?
look like
{
"trigger" : {
"schedule" : {
"interval" : "1m"
}
},
"input" : {
"search" : {
"request" : {
"indices" : [ "logs" ],
"body" : {
"query": {
"bool": {
"must": [
{
"match": {
"type": {
"query": "ssh"
}
}
},
{
"match": {
"ssh_type": {
"query": "login_success"
}
}
}
]
}
}
}
}
}
},
"condition" : {
"compare" : { "ctx.payload.hits.total" : { "gte" : 1 }}
}
"actions" : {
"notify-slack" : {
"throttle_period" : "5m",
"slack" : {
"account" : "team1",
"message" : {
"from" : "watcher",
"to" : [ "#admins", "@chief-admin" ],
"text" : "System X Monitoring",
"attachments" : [
{
"pretext": "Alert new login to server",
"title" : "Server name (from field {{beat.hostname}})",
"text" : "IP login, Usernamem, Time login",
"color" : "#36a64f"
}]
}
}
}
}
}
Thanks!