I have managed to get logstash to work with Log4j 2 by using the "tcp"
input for logstash and json.

Log4j 2:

    <Appenders>
        <Socket name="logstash" protocol="tcp" host="localhost" port="4560">
            <JSONLayout properties="true" compact="true"/>
        </Socket>
    </Appenders>


Logstash:

input {
  tcp {
    port => 4560
    codec => "json"
  }
}



On Mon, May 19, 2014 at 1:37 PM, Karl Kildén <[email protected]> wrote:

> Hi,
>
> Logstash is highly extensible and they include a plugin called "log4j". It
> works out of the box with log4j, see this guide for some screenshots and
> such
>
> http://blog.yeradis.com/2013/10/logstash-and-apache-log4j-or-how-to.htmlThat
> plugin does use the socket appender.
>
> I have used this for some time and I have been a happy end user not really
> getting into technical details at all. But for new projects I want to use
> log4j2 and thus my question... Some efforts to get support in for log4j2
> seems to exist already so I guess I will turn my attention to that.
>
> However it felt best to consult the experts of log4j first ;) However I
> guess I will look closer at ie.
> https://github.com/jurmous/logstash-log4j2and other projects for now
> and see if I can get one running ;)
>
>
> On 19 May 2014 13:27, Gary Gregory <[email protected]> wrote:
>
> > So logstash expects serialized Java Log4j 1.2 event objects over a
> socket?
> > That's not going to work with 2.0 out of the box since our implement is
> > different. Can you provide more information to make sure we all
> understand
> > each other please?
> >
> > Gary
> >
> > <div>-------- Original message --------</div><div>From: Karl Kildén <
> > [email protected]> </div><div>Date:05/19/2014  02:52  (GMT-05:00)
> > </div><div>To: Log4J Users List <[email protected]>
> > </div><div>Subject: Re: Logstash & Log4J2 </div><div>
> > </div>Hi Gary,
> >
> > Perhaps but if it is not possible it is also the wrong route... It would
> be
> > better to get proper log4j2 support done for logstash. I see some
> > engagement in the area when I google for it, I will try to poke around
> and
> > see if I can help with anything
> >
> > cheers
> >
> >
> > On 18 May 2014 16:12, Gary Gregory <[email protected]> wrote:
> >
> > > Hello,
> > >
> > > If you want the functionality of version 1 in version 2, can you
> create a
> > > patch for a new layout and attach it with tests to a new jira?
> > >
> > > Gary
> > >
> > > <div>-------- Original message --------</div><div>From: Karl Kildén <
> > > [email protected]> </div><div>Date:05/16/2014  16:32  (GMT-05:00)
> > > </div><div>To: Log4J Users List <[email protected]>
> > > </div><div>Subject: Logstash & Log4J2 </div><div>
> > > </div>Hello!
> > >
> > > Using the socket appender with log4j1 and logstash simply worked. I
> can't
> > > get it to work with log4j2.
> > >
> > > Any advice on this? Can I make socket appender behave like 1.x?
> > >
> > > cheers
> > >
> >
>



-- 
Mikael Ståldal
Chief Software Architect
*Appear*
Phone: +46 8 545 91 572
Email: [email protected]

Reply via email to