Hi
I am trying to create a watch which should alert our Team only when a certain condition matches,
For example: "whenever a Failed Login Attempt Detected"
RightNow it is sending me an email after each 1 hour with same ctx.paylod.hits.total as no failed login is made and /var/log/secure file has no updates, same time my index which is carrying out /var/log/secure logs is the same as I stopped trying failed attempts, but watcher still sending because it has a scheduled trigger of 1 hr. how can I make it trigger only when a certain condition matches like whenever someone tries to do login and gets failed then only it should send me an email, or whenever index gets updated then only I should get an update by email
{
"trigger": {
"schedule": {
"interval": "1h"
}
},
"input": {
"search": {
"request": {
"body": {
"size": 0,
"query": {
"match_phrase" : {
"message" : "Failed password for invalid user"
}
}
},
"indices": [
"*"
]
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gte": 1
}
}
},
"actions" : {
"gmail_account": {
"email": {
"profile": "standard",
"to": [
"testemail@gmail.com"
],
"subject": "ELK Alert: Failed logging attempts Detected !",
"body": {
"text" : "WARNING: There are {{ctx.payload.hits.total}} Failed logging attempts Detected in last 1 Hour. "
}
}
},
"my-logging-action": {
"logging": {
"text" : "WARNING: There are {{ctx.payload.hits.total}} Failed logging attempts Detected in last 1 Hour. "
}
}
}
}
