Hi,
I want to set watcher alert in which it should alert me if there is any 5XX calls for more than 1 hour. I using this code but it is giving me "ParsingException[[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]]" .
Also the index name changes every day i.e logstash-2018.03.23 on next day it would be logstash-2018.03.24. How can i configure this . Please help me on this
</>PUT _xpack/watcher/watch/5xx alert
{
"trigger": {
"schedule": {
"interval": "60s"
}
},
"input": {
"search": {
"request": {
"indices": [
"logstash-2018.03.23"
],
"body": {
"query": {
"match": {
"response_code": "5**"
},
{
"range" : {
"timestamp": {
"gte" : "now-1h",
"lte" : "now"
}
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"send_email": {
"email": {
"to": "emailid",
"subject": "Watcher 2xx executed",
"body": "{{ctx.watch_id}} executed with {{ctx.payload.hits.total}} hits"
}
}
}
}
</>