Hi
I'm using ES 2.3.5 with the compatible watcher version (2.3.5 ...).
I've been using watcher for a week now, and it works well, except one thing:
Daily trigger does not work. The watch doesn't execute.
The same watch executed just fine when i used "interval", and also when i used the Watcher REST API (_execute).
I'll explain a bit about the watch itself:
I'm using ELK Stack for log gathering and analysis, so i have daily and monthly indices, and as far as i know the best practice is to optimize every index as soon as it is not fed with new data anymore (end of day, end of month etc.).
So I have a watch that just triggers the optimize API using a webhook.
I know it's not a common watcher use case, but i don't know a better way of doing it (if you have one please let me know )
Anyway, here is the watch (for a daily index optimization):
{
"trigger": {
"schedule": {
"daily": {
"at": "03:20"
}
}
},
"transform": {
"script": {
"id": "daily_dateSplitScript",
"lang": "groovy",
"params": {}
}
},
"actions": {
"optimizeWebhook": {
"webhook": {
"scheme": "HTTP",
"method": "POST",
"host": "myHostName", \\ This is not the real name of course...
"read_timeout": "1m", \\ In order to wait for the optimization to finish
"port": 9200,
"path": "/myIndexName-{{ctx.vars.newTime}}/_optimize?max_num_segments=1",
"body": ""
}
}
}
}
And this is the daily_dateSplitScript indexed script:
ctx.vars.newTime = (ctx.execution_time).minusDays(1).toDate().format('YYYY.MM.dd'); return ctx.vars.newTime
As you can see, my daily indices are of the format myIndexName-YYYY.MM.dd
Again - both watch and script work together well with the interval triger. I tried more than one daily trigger (different hours).
And the watch execution info is not being indexed in the .watch_history while other watches do get indexed. It's state is "awaits_successful_execution" as if it is not triggered at all.
Can you spot my mistake?
And can you suggest any other way to optimize daily/weekly/monthly indices as they finish being fed with new data?
Thanks a lot!