Created
March 17, 2016 15:03
-
-
Save lcostantini/6296ac20cd268be8a345 to your computer and use it in GitHub Desktop.
Watcher configuration to detect two or more HTTP 500 consecutive
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": "20s" | |
} | |
}, | |
"input": { | |
"search": { | |
"request": { | |
"indices": ["logstash-*"], | |
"body": { | |
"query": { | |
"filtered": { | |
"query": { | |
"query_string": { | |
"query": "@status:500", | |
"analyze_wildcard": true | |
} | |
}, | |
"filter": { | |
"bool": { | |
"must": [{ | |
"range": { | |
"@timestamp": { | |
"gte": "now-20s" | |
} | |
} | |
}], | |
"must_not": [] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition": { | |
"compare": { | |
"ctx.payload.hits.total": { "gt": 1 } | |
} | |
}, | |
"actions": { | |
"send_email": { | |
"email": { | |
"to": "your@email.com", | |
"subject": "Multiple 500 errors", | |
"body": "The /healt-check endpoint receive {{ctx.payload.hits.total}} HTTP 500 consecutively." | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment