【发布时间】:2017-02-08 07:56:55
【问题描述】:
我想在 Kibana 5 中添加脚本字段以从消息中获取存储的过程名称。能够可视化每个 SP 的错误数量。 我有“消息”字段,我可以在其中看到错误文本:
"[2017-02-03 05:04:51,087] @ MyApp.Common.Server.Logging.ExceptionLogger [ERROR]: XmlWebServices Exception
User:
Name: XXXXXXXXXXXXXXXXXXXXXXX
Email: 926715@test.com
User ID: 926715 (PAID)
Web Server: PERFTESTSRV
Exception:
Type: MyApp.Common.Server.DatabaseException
Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Source: MyApp.Common.Server
Database: MyDB
Cmd Type: StoredProcedure
Cmd Text: spGetData
Trans: YES
Trans Lvl: Unspecified"
指南:https://www.elastic.co/blog/using-painless-kibana-scripted-fields
我的计划是添加类似 Painless 脚本的内容:
def m = /(?:Cmd\sText:\s*)[a-zA-Z]{1,}/.matcher(doc['message'].value);
if ( m.matches() ) {
return m.group(1)
} else {
return "no match"
}
我也试过了
def tst = doc['message'].value;
if (tst != null)
{
def m = /(?:User\sID:\s*)[0-9]{1,}/.matcher(tst);
if ( m.matches() ) {
return m.group(1)
}
} else {
return "no match"
}
如何处理 doc['message'].value? 当我尝试这样做时,出现错误“Courier Fetch: 5 of 5 shards failed.” 当我尝试 doc['message.keyword'].value 时,里面没有完整的消息。我不明白我在哪里可以了解内部消息的结构以及如何引用它?
【问题讨论】:
-
我有 script.painless.regex.enabled: true
-
message的映射看起来如何?当您的脚本中只有以下内容时,您会从脚本字段中得到什么:doc['message.keyword'].value? -
不确定如何获取消息映射这是我在 Kibana 中看到的 joxi.ru/5mdvBMjSkelGdA 当我有 doc['message.keyword'].value 时,对于我需要的错误类型,我有以下结果结果我只有“ - ”
-
您是否收到了预期的全部信息?还是缺少什么? `需要我只有“ - ”作为结果是什么意思?
-
对于这种类型的错误,我需要 doc['message.keyword'].value dash 作为结果,并且在“消息”中,屏幕截图中的数据有点像(或在我的示例中)在带有错误文本的问题中)存在一些错误,字段 doc['message.keyword'].value 的结果与字段消息相同。但不幸的是,不适合我需要的人。
标签: regex kibana elasticsearch-painless