Created
December 14, 2018 13:13
-
-
Save hilt86/0402f498c4823d42b41d6469c85d2a64 to your computer and use it in GitHub Desktop.
Watcher alert to notify on failed SSH logins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"trigger": { | |
"schedule": { | |
"interval": "300s" | |
} | |
}, | |
"input": { | |
"search": { | |
"request": { | |
"search_type": "query_then_fetch", | |
"indices": [ | |
"filebeat-*" | |
], | |
"types": [], | |
"body": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"system.auth.ssh.event": [ | |
"Failed", | |
"Invalid" | |
], | |
"boost": 1 | |
} | |
}, | |
{ | |
"range": { | |
"@timestamp": { | |
"gte": "now-5m" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition": { | |
"compare": { | |
"ctx.payload.hits.total": { | |
"gt": 1 | |
} | |
} | |
}, | |
"actions": { | |
"notify-slack": { | |
"throttle_period_in_millis": 300000, | |
"slack": { | |
"message": { | |
"to": [ | |
"#devops" | |
], | |
"text": "Encountered {{ctx.payload.hits.total}} failed SSH logins in the last 5 minutes (facepalm)" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment