我安裝了監視器並給出了條件。同時給予其條件給我錯誤...無法爲elasticsearch提供條件給觀察者?
{"error":"WatcherException[failed to put watch [log_error_watch]]; nested:
ScriptConditionValidationException[failed to compile script [return
ctx.payload.hits.total > 5] with lang [groovy] of type [INLINE]]; nested:
ScriptException[dynamic scripting for [groovy] disabled]; ","status":500}
什麼是動態腳本?它給我錯誤,它被禁用。 我的觀察者狀況如下。
curl -XPUT 'http://localhost:9200/_watcher/watch/log_error_watch' -d '{
"metadata" : {
"color" : "red"
},
"trigger" : {
"schedule" : {
"interval" : "10s"
}
},
"input" : {
"search" : {
"request" : {
"search_type" : "count",
"indices" : "logs",
"body" : {
"query" : { "match" : { "status" : "error" } }
}
}
}
},
"condition" : {
"script" : "return ctx.payload.hits.total > 5"
},
"transform" : {
"search" : {
"request" : {
"indices" : "logs",
"body" : {
"query" : { "match" : { "status" : "error" } }
}
}
}
},
"actions" : {
"my_webhook" : {
"webhook" : {
"method" : "GET",
"host" : "mylisteninghost",
"port" : 9200,
"path" : "/{{watch_id}}",
"body" : "Encountered {{ctx.payload.hits.total}} errors"
}
},
"email_administrator" : {
"email" : {
"to" : "[email protected]",
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
"body" : "Too many error in the system, see attached data",
"attach_data" : true,
"priority" : "high"
}
}
}
}'
我刪除守望歷史,並再次安裝。即時通訊得到這樣的錯誤再次.. 。 ------------------------------------------------- ----> {「error」:「WatcherException [未能放置watch [error_status]];嵌套:StrictDynamicMappingException [映射設置爲嚴格,不允許在[watch]內動態引入[_status]];」,「,狀態「:500} –
看起來您已安裝了預發佈版本的觀察器。請按照此處的說明進行升級:https://www.elastic.co/guide/en/watcher/current/release-notes.html#upgrade-instructions –