如果在过去10分钟内发生错误,我将使用ElastAlert通知我的用户。我想发送发生的错误列表。但是,如果在errorCode中存在连字符('-'),则列表中的项被分成两个部分
这是我想要的结果
errorCode:
error1: 10
error-place-2: 15
error-new-place-3: 20这是我得到的结果
erorrCode:
error1: 10
error: 35
place: 35
2: 15
new: 20
3: 20有没有办法取得预期的结果?
更新-添加索引映射的结果
{
"indexdate":{
"mappings":{
"app_log":{
"properties":{
},
"transaction_log":{
"properties":{
"@timestamp":{
"type":"date",
"format":"strict_date_optional_time||epoch_millis"
},
"other":{
},
"errorCode":{
"type":"string"
},
"other":{
},
}
}
}
}
}发布于 2016-09-30 08:52:43
您需要确保您的errorCode字段是not_analyzed,因为情况似乎并非如此,因此您的错误代码被拆分。
您可以这样修改您的映射:
curl -XPUT localhost:9200/indexdate/_mapping/transaction_log -d '{
"properties": {
"errorCode":{
"type":"string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}'在进行此更改后,您需要重新索引您的数据,以便填充errorCode.raw字段。
然后,您需要在errorCode.raw配置中使用ElastAlert,而不是errorCode
https://stackoverflow.com/questions/39785293
复制相似问题