Hi,
I want to set a watcher to read last 3 indices name start with "logstash-*" with number of documents per index.Then send a alert to admin user. Indices are created with current data format.For example index name for 9th Jan 2018 is "logstash-2018.01.09".
Here is my current configuration -
PUT _xpack/watcher/watch/my-watch
{
"trigger": {
"schedule": {
"interval": "10000s"
}
},
"input" : {
"chain" : {
"inputs" : [
{
"first" : {
"search": {
"request": {
"indices": [
"<logstash-{now/d}>"
],
"body": {
"size": 0,
"query": {
"bool": {
"filter": [
]
}
}
}
}
}
}
},
{
"second" : {
"search": {
"request": {
"indices": [
"<logstash-{now/d-1d}>"
],
"body": {
"size": 0,
"query": {
"bool": {
"filter": [
]
}
}
}
}
}
}
},
{
"third" : {
"search": {
"request": {
"indices": [
"<logstash-{now/d-2d}>"
],
"body": {
"size": 0,
"query": {
"bool": {
"filter": [
]
}
}
}
}
}
}
}
]
}
},
"actions": {
"send_email": {
"email": {
"to": "",
"subject": "ELK Notifications",
"body": {
"html": "<ul><li>Today : - {{ctx.payload.first.hits.total}}</li><li>Yesterday : - {{ctx.payload.second.hits.total}}</li><li>The day before yesterday : - {{ctx.payload.third.hits.total}}</li></ul>"
}
}
}
}
}
How can I set index name Today , Yesterday and The day before yesterday in action's email body.
I tried to set "<logstash-{now/d}>" email body , but it did not worked.