2014-06-17 3 views
0

json 형식으로 로그 메시지를 수신하고 싶습니다. 또한 이전에 발견 된 로그로 공간을 시작으로 로그를 병합해야합니다 (같은 전자 메일에서 스택 트레이스를 보내려면).logstash에서 multiline 및 json 코덱을 동시에 사용하는 방법은 무엇입니까?

공식 사이트에서 첫 번째 작업에 필요한 코덱은 "json"입니다. 두 번째 작업에서 필요한 코덱은 "다중 라인"입니다.

두 작업을 동시에 수행하는 방법은 무엇입니까?

는 여기에 예제가

2014-06-17 14:47:22,490 DEBUG [-] com.tigerit.evr.util.EvrAuthManager (EvrAuthManager.java:61) - User details are good and ready to go 

로그입니다 그리고 여기 예제 스택 트레이스입니다 -

com.bea.core.repackaged.springframework.beans.factory.BeanCreationException: Dependency injection failure: can't find the bean definition about class interface javax.jms.Queue; nested exception is com.bea.core.repackaged.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.jms.Queue] is defined: No beans of type javax.jms.Queue; owner=com.bea.core.repac[email protected]1364679d: display name [com.bea.core.repac[email protected]1364679d]; startup date [Wed Jun 18 10:10:36 BDT 2014]; parent: com.bea.core.repac[email protected]61932006 

     at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.applyInjections(Jsr250Metadata.java:244) 

     at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.inject(Jsr250Metadata.java:226) 

     at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBrokerImpl.injection(EjbComponentCreatorBrokerImpl.java:112) 

     at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBrokerImpl.getBean(EjbComponentCreatorBrokerImpl.java:70) 

     at weblogic.ejb.container.injection.EjbComponentCreatorImpl.getBean(EjbComponentCreatorImpl.java:68) 

     at weblogic.ejb.container.manager.BaseEJBManager.createNewBeanInstance(BaseEJBManager.java:216) 

내가 이전 로그 메시지와 함께 병합 "에"로 시작하는 줄을 추가하고 싶습니다.

+1

요청한 내용을 설명하기 위해 몇 가지 로그 샘플을 제공 할 수 있습니까? – Alcanzar

+0

@Alcanzar, 질문이 편집되었습니다. :) –

답변

1

주어진 입력에 대해 여러 개의 필터를 사용할 수 있습니다. 예를 들어, 스택 추적 행 병합 할 문서의 예에서와 같이 입력에 여러 줄의 코드를 사용할 수 나중에 config 파일에서 당신이 할 수있는 다음

input { 
    stdin { 
    codec => multiline { 
     pattern => "^\s" 
     what => "previous" 
    } 
    } 
} 

과 뭔가

filter { 
    if [message] =~ /^{.*}$/ { 
     json { source => message } 
    } 
} 

같은 따라서 중괄호로 시작하거나 끝나는 줄이 생기면 해당 줄을 json으로 처리 할 수 ​​있습니다.

관련 문제