2016-09-20 6 views
-1

以下のログファイルのgrokパターンを調べようとしています。これには、成功ログの1行と警告ログの1項目が含まれています。このログファイルにgrokを書き込む方法

2016-09-03T12:53:31-04:00 DEV SampleFileService INFO 512132:414618:SampleFileService-2-FTS EXECUTING: Error Handling Client Request started 

2016-09-03T12:53:31-04:00 DEV SampleFileService WARNING 512133:414618:SampleFileService-2-FTS ERROR: Error while sending ErrorHandler request to IEHS Queue: test.queue.publish 
Retry count 1 of 3, 
Error: 
<ns0:ErrorReport xmlns:ns0="http://www.tibco.com/pe/EngineTypes"> 
    <StackTrace>Job-414618 Error in [Process-Path!!] 
There was an unexpected error while sending a message. 
    at com.tibco.plugin.share.jms.impl.JMSSender.send(Unknown Source) 
    at com.tibco.plugin.share.jms.impl.JMSSender.send(Unknown Source) 
    at com.tibco.plugin.jms.JMSAbstractTransmitActivity.eval(Unknown Source) 
    at com.tibco.pe.plugin.Activity.eval(Unknown Source) 
    at com.tibco.pe.core.TaskImpl.eval(Unknown Source) 
    at com.tibco.pe.core.Job.a(Unknown Source) 
    at com.tibco.pe.core.Job.k(Unknown Source) 
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) 
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) 
caused by: com.tibco.plugin.share.jms.impl.JMSExceptionWrapper: javax.jms.JMSException: Failure storing message 
    at com.tibco.plugin.share.jms.impl.JMSPluginException.&lt;init&gt;(Unknown Source) 
    at com.tibco.plugin.share.jms.impl.JMSSender.send(Unknown Source) 
    at com.tibco.plugin.share.jms.impl.JMSSender.send(Unknown Source) 
    at com.tibco.plugin.jms.JMSAbstractTransmitActivity.eval(Unknown Source) 
    at com.tibco.pe.plugin.Activity.eval(Unknown Source) 
    at com.tibco.pe.core.TaskImpl.eval(Unknown Source) 
    at com.tibco.pe.core.Job.a(Unknown Source) 
    at com.tibco.pe.core.Job.k(Unknown Source) 
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) 
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) 
Caused by: javax.jms.JMSException: Failure storing message 
    at com.tibco.tibjms.Tibjmsx.buildException(Tibjmsx.java:612) 
    at com.tibco.tibjms.TibjmsxSessionImp._publish(TibjmsxSessionImp.java:1544) 
    at com.tibco.tibjms.TibjmsMessageProducer._publish(TibjmsMessageProducer.java:246) 
    at com.tibco.tibjms.TibjmsQueueSender.send(TibjmsQueueSender.java:74) 
    ... 9 more 
</StackTrace> 
    <Msg>There was an unexpected error while sending a message.</Msg> 
    <FullClass>com.tibco.plugin.share.jms.impl.JMSPluginException</FullClass> 
    <Class>JMSPluginException</Class> 
    <ProcessStack>Stack-Path!!</ProcessStack> 
    <MsgCode>BW-JMS-100039</MsgCode> 
</ns0:ErrorReport> 
+0

は、あなたがあなたのログから抽出したいものを示してもらえますか?検索する情報がない場合、grokフィルタは役に立たないからです。 – baudsp

+0

また、[grok filter tester](http://grokconstructor.appspot.com/do/match#result)、[grok filter documentation](https://www.elastic.co/guide/en/logstash /current/plugins-filters-grok.html)と[grok patterns](https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns)を参照してください。 – baudsp

+0

最初の行を考慮すると、 タイムスタンプ - > 2016-09-03T12:53:31-04:00、 Env - > Dev、アプリケーション - > SampleFileService、 レベル - >情報、 スレッド - > 512132: (メッセージのリマインダ) 2行目には、 'Message'フィールドの詳細情報が記録されています。 –

答えて

2

あなたはそう、あなたのメッセージのすべてが一緒にグループ化され、あなたの入力に複数行filter/codecを使用する必要があります。

multiline { 
    pattern => "%{TIMESTAMP_ISO8601}" 
    negate => "true" 
    what => "previous" 
} 

これは、ISO 8601の日付で始まらない行を前のものとグループ化します。したがって、2番目のメッセージの場合は、すべての行が一緒になります。

次に、あなたは、このGROKパターンを使用することができます。

grok { 
    match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}%{SPACE}%{WORD:env}%{SPACE}%{WORD:application}%{SPACE}%{WORD:level}%{SPACE}%{NOTSPACE:thread}%{SPACE}%{WORD:status}:%{SPACE}%{GREEDYDATA:message}" } 
} 
+0

私はいくつかの組み合わせを試しましたが、初心者は、パターンの構文は少し紛らわしい..私が分析しようとしていたログは、いくつかのタブの区切りを持っていた(それはここに貼り付けた後に 'スペース'と判明した...決して気にしない:))。また、 '512132:414618:SampleFileService-2-FTS'のような文字列を1つの単語にまとめることはできませんでした。それも分割されていた。私はhttps://github.com/hpcugent/logstash-patterns/blob/master/files/grok-patternsを参照しましたが、私は上記のログメッセージにどこに応募するべきかを知りません。あなたの助けに感謝します。あなたは愚かです...救世主を言うでしょう。ありがとうございます.. –

+0

よろしくお願いします。それは動作しましたか?期待した結果が得られない/しない場合は、質問に情報を追加するのをためらってはいけません – baudsp

関連する問題