# Log4j2 input plugin

**URL:** <https://discuss.elastic.co/t/log4j2-input-plugin/32171>\
**Category:** Logstash\
**Created:** [October 14, 2015, 12:46pm UTC](https://discuss.elastic.co/t/log4j2-input-plugin/32171 "2015-10-14T12:46:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndiSosp](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@AndiSosp](https://discuss.elastic.co/u/AndiSosp)\
**Post date:** [October 14, 2015, 12:46pm UTC](https://discuss.elastic.co/t/log4j2-input-plugin/32171/1 "2015-10-14T12:46:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![StephenGoodall](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@StephenGoodall](https://discuss.elastic.co/u/StephenGoodall)\
**Post date:** [November 3, 2015, 11:19am UTC](https://discuss.elastic.co/t/log4j2-input-plugin/32171/2 "2015-11-03T11:19:57Z")

</div>

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](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](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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:24am UTC](https://discuss.elastic.co/t/log4j2-input-plugin/32171/3 "2017-07-06T05:24:19Z")

</div>


