I'm using ELK 2.3.3,logstash 2.3.2 . When I'm trying to use log4j as input,logstash reports java.lang.NullPointerException.
here is my logstash config:
input { log4j { type => "log4j-type" port => 4560 } } output { elasticsearch { index => "logstash-%{type}-%{+YYYY.MM.dd}" hosts => ["192.168.10.203:9200"] } }
log4j.properties:
log4j.rootLogger=INFO,console
# for package com.demo.elk, log would be sent to socket appender. log4j.logger.com.demo.elk=DEBUG, socket
# appender socket log4j.appender.socket=org.apache.log4j.net.SocketAppender log4j.appender.socket.Port=4560 log4j.appender.socket.RemoteHost=bg1 log4j.appender.socket.layout=org.apache.log4j.PatternLayout log4j.appender.socket.layout.ConversionPattern=%d [%-5p] [%l] %m%n log4j.appender.socket.ReconnectionDelay=10000
# appender console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.target=System.out log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d [%-5p] [%l] %m%n
logstash printed this when I ran my project:
Closing connection {:client=>"192.168.22.27:54256", :exception=>java.lang.NullPointerException, :level=>:debug, :file=>"logstash/inputs/log4j.rb", :line=>"111", :method=>"handle_socket"}