From 74415b97e7452c2c90d7bad26dff5bf5c6acef24 Mon Sep 17 00:00:00 2001 From: liugq Date: Tue, 29 Aug 2023 16:00:44 +0800 Subject: [PATCH] get event message list with default order by updated --- plugin/api/alerting/message.go | 4 ++-- service/alerting/elasticsearch/engine.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/api/alerting/message.go b/plugin/api/alerting/message.go index 3a8d790a..8e3b249f 100644 --- a/plugin/api/alerting/message.go +++ b/plugin/api/alerting/message.go @@ -260,11 +260,11 @@ func (h *AlertAPI) searchAlertMessage(w http.ResponseWriter, req *http.Request, if sort != "" { sortParts := strings.Split(sort, ",") - if len(sortParts) == 2 && sortParts[1] != "created" { + if len(sortParts) == 2 && sortParts[1] != "updated" { sortBuilder.WriteString(fmt.Sprintf(`{"%s":{ "order": "%s"}},`, sortParts[0], sortParts[1])) } } - sortBuilder.WriteString(`{"created":{ "order": "desc"}}`) + sortBuilder.WriteString(`{"updated":{ "order": "desc"}}`) if status != "" { mustBuilder.WriteString(",") diff --git a/service/alerting/elasticsearch/engine.go b/service/alerting/elasticsearch/engine.go index a6cfc647..72b92a33 100644 --- a/service/alerting/elasticsearch/engine.go +++ b/service/alerting/elasticsearch/engine.go @@ -671,7 +671,7 @@ func (engine *Engine) Do(rule *alerting.Rule) error { conditionResults := checkResults.ResultItems var paramsCtx map[string]interface{} if len(conditionResults) == 0 { - alertItem.Priority = "info" + alertItem.Priority = "" if checkResults.QueryResult.Nodata { alertItem.State = alerting.AlertStateNodata }