2016-09-20 3 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 수 패턴을 사용할 수 있습니까? 검색 할 정보가 없으면 Grok 필터가 쓸모가 없기 때문입니다. – baudsp

+0

또한 도움을 요청하십시오 : [grok filter tester] (http://grokconstructor.appspot.com/do/match#result), [grok 필터 설명서] (https://www.elastic.co/guide/en/logstash /current/plugins-filters-grok.html) 및 [grok 패턴] (https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns)을 참조하십시오. – baudsp

+0

첫 번째 줄을 고려하면 타임 스탬프 -> 2016-09-03T12 : 53 : 31-04 : 00, Env -> Dev, Application -> SampleFileService, 레벨 -> 정보, 스레드 -> 512132 :스레드를 고려해야합니다. 414618 : SampleFileService-2-FTS, 상태 -> 실행 중, 메시지 -> (메시지 미리 알림) 두 번째 줄에는 '메시지'필드에 대해 더 많은 정보가 기록됩니다 .. –

답변

2

당신은 너무 당신의 모든 메시지가 함께 그룹화됩니다 귀하의 의견에 여러 줄 filter/codec을 사용해야합니다.

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

이렇게하면 이전의 ISO 8601 날짜로 시작하지 않는 행이 그룹화됩니다. 따라서 두 번째 메시지의 경우 모든 줄이 함께 나타납니다.

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'와 같은 문자열을 단일 단어로 결합 할 수 없습니다. 그것은 나눠지고있었습니다. 비록 내가 https://github.com/hpcugent/logstash-patterns/blob/master/files/grok-patterns를 언급했지만, 위의 로그 메시지에 어디에서 적용해야하는지 안다. 도움을 주시면 고맙겠습니다. 각도 u는 바보입니다 ... 구세주라고 말할 것입니다. 고마워요 .. –

+0

당신은 오신 것을 환영합니다. 작동 했나요? 기대 한 결과를 얻지 못하면// 질문에 정보를 추가하는 것을 망설이지 말라. – baudsp

관련 문제