Thiago Casa Nova
Thiago Casa Nova

Reputation: 248

How to send logs from Log4J to Fluentd editind lo4j.properties

I'm have a fluentd setup currently using TCP as a source to receive some logs, it's working fine. Now I need to set up another application that uses Log4J, but i musnt change the source code, only the config files. How can I setup log4j.properties (or other files) to send logs to fluentd(running in another machine, but in the same network)? Right now I have:

I was testing both a appender made to fluentd and the socket one, to send using TCP, but it's not working.

#TEST#
log4j.rootLogger=WARN, BLAH  
# to connect to the remote server 
log4j.appender.BLAH=org.apache.log4j.net.SocketAppender  
# set set that layout to be SimpleLayout 
log4j.appender.BLAH.layout=org.apache.log4j.SimpleLayout  
#log4j.appender.BLAH.File= admin.log  
log4j.appender.BLAH.Port= 21001 
log4j.appender.BLAH.RemoteHost=tcp://192.168.14.130

log4j.rootLogger=WARN, fluentd
log4j.appender.fluentd=com.twimba.fluentd4log4j.FluentdAppender.java
log4j.appender.fluentd.host="192.168.14.130"
log4j.appender.fluentd.port=21003
log4j.appender.fluentd.tag="log4j"

Currently my fluentd instance is not receiving anything. I wish it's were showing the logs.

Upvotes: 2

Views: 10023

Answers (2)

Bharat Gadde
Bharat Gadde

Reputation: 378

You can use fluentd-log4j-appender specified in https://github.com/technologize/fluency-log4j-appender

Upvotes: 0

Related Questions