Skip to content

Instantly share code, notes, and snippets.

@keyboardAnt
Last active September 11, 2016 11:16
Show Gist options
  • Save keyboardAnt/9dbf094123c818cd68bd986b52af9dd5 to your computer and use it in GitHub Desktop.
Save keyboardAnt/9dbf094123c818cd68bd986b52af9dd5 to your computer and use it in GitHub Desktop.
ES watch: core dumps query
PUT _watcher/watch/core_dumps_slack
{
"trigger" : {
"schedule" : {"interval" : "1m"}
},
"input" : {
"search" : {
"request" : {
"body" : {
"query": {
"bool": {
"must": [
{"exists": {"field": "session.core_dumps"}},
{"range": {"_timestamp": {"from": "now-1m"}}}
]
}
}
}
}
}
},
"condition" : {
"compare" : {
"ctx.payload.hits.total": {"gt": 0}
}
},
"actions" : {
"notify-slack" : {
"throttle_period" : "1m",
"slack" : {
"message" : {
"to" : [ "#new-core-dumps" ],
"text" : "Found {{ctx.payload.hits.total}} new core dumps: {{ctx.payload.hits.hits}}"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment