メッセージから格納されたproc名を取得するために、Kibana 5にscritptedフィールドを追加したいとします。各SPごとのエラー数を視覚化できるようにする。 私はエラーテキストを見ることができ、フィールド "メッセージ" を持っている:kibana 5正規表現一致のスクリプトフィールド
"[2017-02-03 05:04:51,087] @ MyApp.Common.Server.Logging.ExceptionLogger [ERROR]: XmlWebServices Exception
User:
Name: XXXXXXXXXXXXXXXXXXXXXXX
Email: [email protected]
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
私の計画は次のように無痛スクリプトとして何かを追加することです:
def m = /(?:Cmd\sText:\s*)[a-zA-Z]{1,}/.matcher(doc['message'].value);
if (m.matches()) {
return m.group(1)
} else {
return "no match"
}
もI試しました
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']にどのように対処できますか。 ? 私がそうしようとするとエラーが表示されます。 "Courier Fetch:5個のシャードのうち5個が失敗しました。" doc ['message.keyword']。valueを試してみると、内部に完全なメッセージがありません。私はメッセージが内部に持つ構造をどこで知ることができ、どのように私がそれを参照できるのか理解できません。
script.painless.regex.enabled:true –
あなたのマッピングは 'message'のようにどのように見えますか?そしてスクリプト内にスクリプトフィールドがあれば、あなたのスクリプトフィールドには何が届いていますか?** doc ['message.keyword']。value **? – Kulasangar
ここでメッセージ のマッピングを取得する方法がわからない私はKibana で見るものであるhttp://joxi.ru/5mdvBMjSkelGdA 私はDOC [「message.keyword」]を持っている。値 私はタイプの結果を以下していますエラーが発生する必要があります。結果として " - "しか表示されません。 –