2012-09-27 3 views

답변

0

문서화 된대로 here은 어떤 로그 파일을 사용할 수 있지만 원본의 출처는 중요하지 않습니다. 입력을 파일로 사용하고 이에 따라 다른 것을 구성해야합니다!

input { 
    file { 
## Your configuration goes here like file path 
## and other config, check documentation 
} 
} 
1

이것은 Java 로깅 프레임 워크의 선택과 로깅 프레임 워크의 출력 형식에 따라 달라질 수 있습니다. http://logstash.net/docs/1.1.9/inputs/log4j

input { 
    log4j { 
    add_field => ... # hash (optional), default: {} 
    charset => ... # string, one of ["ASCII-8BIT", "UTF-8", "US-ASCII", ...] (optional), default: "UTF-8" 
    data_timeout => ... # number (optional), default: 5 
    debug => ... # boolean (optional), default: false 
    format => ... # string, one of ["plain", "json", "json_event"] (optional) 
    host => ... # string (optional), default: "0.0.0.0" 
    message_format => ... # string (optional) 
    mode => ... # string, one of ["server", "client"] (optional), default: "server" 
    port => ... # number (required) 
    tags => ... # array (optional) 
    type => ... # string (required) 
    } 
} 
2

톰캣 자바 백분율 로깅을 사용

logstash

문서는 일례의 log4j 입력 파서를 제공한다.

직접 GELF appender를 사용하여 Tomcat에서 logstash로 로그를 제출할 수 있습니다.

/conf/logging.properties :

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler, biz.paluch.logging.gelf.jul.GelfLogHandler 

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler, biz.paluch.logging.gelf.jul.GelfLogHandler 


biz.paluch.logging.gelf.jul.GelfLogHandler.host=udp:localhost 
biz.paluch.logging.gelf.jul.GelfLogHandler.port=12201 
biz.paluch.logging.gelf.jul.GelfLogHandler.level=INFO 

/bin/catalina.sh

당신은 당신의 시작 스크립트에 약간의 변화와 로거 설정 (및 두 개의 항아리)가 필요합니다 :

if [ -r "$CATALINA_BASE/bin/logstash-gelf-1.4.2.jar" ] ; then 
    CLASSPATH=$CLASSPATH:$CATALINA_BASE/bin/logstash-gelf-1.4.2.jar:$CATALINA_BASE/bin/json-simple-1.1.jar:$CATALINA_BASE/bin/jedis-2.5.1.jar:$CATALINA_BASE/bin/commons-pool2-2.0.jar 
fi 

logstash-GElf는 : logstash-gelf-1.5.2-logging-module.zip

Changes for logstash-gelf with Tomcat

보기
관련 문제