Log4j2 input plugin


#1

Hi everyone,

I'm trying to get Log4j2 SocketAppenders to log directly in to logstash with the log4j plugin but no messages are processed by logstash. Is the log4j input plugin not working with log4j 2.x?

Logstash 1.5.4
Log4j 2.4.1

Logstash input plugin:

log4j {
	mode => "server"
	host => "127.0.0.1"
	port => 9500
	type => "log4j"
} 

Log4j2 Appender config:

<Socket name="Socket" host="127.0.0.1" port="9500" immediateFlush="true">
    <PatternLayout pattern = "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Socket>

If i switch to the tcp plugin in logstash the process does work as expected, so I'll use this for now.


(Stephen Goodall) #2

Hi,
You will need to use a log4j2 input plugin as I think the format is different to log4j. I've used https://github.com/jurmous/logstash-log4j2 with a "Serialized" pattern layout:

<Socket name="Logstash" host="HOST" port="PORT" immediateFlush="false" connectTimeoutMillis="5000">
  <SerializedLayout />
</Socket>

I've just upgraded to LS 2.0 and I can't figure out how to get it installed, the plugin has a dependency for Logstash to be < 2.0 so it isn't working, I've tried changing that value and install it from the source file but I still don't think its working.
It now appears in https://github.com/logstash-plugins/logstash-input-log4j2 but I don't know if it is being worked on or anything as it looks like a skeleton project, there are no actual files for it.


(system) #3