2017-04-18 8 views
0

Logstash를 사용하여 오류 로그를 구문 분석하여 몇 가지 필드, 특히 errormessage를 캡처하려고합니다. 그러나 Logstash에서 오류 메시지를 캡처 할 수 없습니다. 아래는 내가 쓴 실제 오류 메시지 파서는Logstash Grok Parser가 작동하지 않습니다.

 12345 http://google.com 2017-04-17 09:02:43.065 ERROR 10479 --- [http-nio-8052-exec-2] com.utilities.TokenUtils  : Error 

org.xml.SAXParseException: An invalid XML character (Unicode: 0xe) was found in the value of attribute "ID" and element is "saml". 
    at org.apache.parsers.DOMParser.parse(Unknown Source) 
    at org.apache.jaxp.DocumentBuilderImpl.parse(Unknown Source) 
    at javax.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) 
    at com.utilities.TokenUtils.validateSignature(TokenUtils.java:99) 

파서 :

`%{NOTSPACE:stnum}\s*%{NOTSPACE:requestURL}\s*%{TIMESTAMP_ISO8601:log_timestamp}\s*%{LOGLEVEL:loglevel}\s*%{NUMBER:pid}\s*---\s*\[(?<thread>[A-Za-z0-9-]+)\]\s*%{DATA:class}\s*:\s%{NOTSPACE:level}\s*(?<errormessage>.[^\n]*).[^\n]*` 

내가 로그에서이 메시지를 캡처하는 것을 시도하고있다 :

org.xml.SAXParseException: An invalid XML character (Unicode: 0xe) was found in the value of attribute "ID" and element is "saml". 
+0

로그 파일과 logstash 필터 파일의 일부를 게시 할 수 있습니까? – Vitorlui

답변

0

당신이 파서이다 logstash 사용 하시겠습니까? conf 파일을 보내 주시면 더 많은 정보를 제공해 드릴 수 있습니다. 다음은 로그에서 예외 유형을 구문 분석하는 샘플입니다 (grok 필터 사용).

filter { 
grok { 
match => ["message", "%{DATA:errormessage} %{GREEDYDATA:EXTRA}"] 
} 
}