2016-11-18 3 views
0

Ich habe versucht (und scheiterte) Logstash mit Log4j SocketAppender arbeiten.logstash funktioniert nicht mit log4j über SocketAppender

Hier ist meine log4j.properties:

log4j.appender.tcp=org.apache.log4j.net.SocketAppender 
log4j.appender.tcp.Port=4560 
log4j.appender.tcp.RemoteHost=localhost 
log4j.appender.tcp.ReconnectionDelay=10000 
log4j.appender.tcp.Application=playground 

logstash.conf

input { 
    log4j { 
    } 
} 
output { 
    stdout {} 
} 

I logstash Protokollierungsstufe eingestellt haben, TRACE und an eine Log-Nachricht. Danach fand ich die folgenden Zeilen in der Konsole Log von Logstash:

11:44:35.778 [Ruby-0-Thread-21: c:/_work/issues/log4j_socketappender/logstash-5.0.1/vendor/bundle/jruby/1.9/gems/logstash-input-log4j-3.0.3-java/lib/logstash/inputs/log4j.rb:155] DEBUG logstash.inputs.log4j - Accepted connection {:client=>"127.0.0.1:61823", :server=>"0.0.0.0:4560"} 
11:44:35.795 [Ruby-0-Thread-21: c:/_work/issues/log4j_socketappender/logstash-5.0.1/vendor/bundle/jruby/1.9/gems/logstash-input-log4j-3.0.3-java/lib/logstash/inputs/log4j.rb:155] DEBUG logstash.inputs.log4j - Closing connection {:client=>"127.0.0.1:61823", :exception=>#<IOError: org.apache.log4j.spi.LoggingEvent; class invalid for deserialization>} 

Jede Hilfe wird sehr geschätzt.

Antwort

2

Es ist ein Fehler. Es gibt eine Abhilfe:

Datei lokalisiert logstash-core/lib/jars.rb im Logstash Installationsverzeichnis, kommentieren Sie die folgende Zeile:

require_jar('org.apache.logging.log4j', 'log4j-1.2-api', '2.6.2') 

hier diskutiert: GitHub Issue

Verwandte Themen