Skip to content

Instantly share code, notes, and snippets.

@lcostantini
Created March 17, 2016 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcostantini/6296ac20cd268be8a345 to your computer and use it in GitHub Desktop.
Save lcostantini/6296ac20cd268be8a345 to your computer and use it in GitHub Desktop.
Watcher configuration to detect two or more HTTP 500 consecutive
{
"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