0

I have installed ZooKeeper. ZooKeeper by default uses Apache's log4j. I need the ZooKeeper logs to go to rsyslog. But I do not know how to do this. How do I configure ZooKeeper to use rsyslog?

1 Answer 1

2

You need to configure log4j of zookeeper respectively. This can be done in /etc/zookeeper/conf/log4j.properties. Note that you are then interfering with the installed defaults. I don't know yet how to configure this in such a way that it survives an upgrade properly.

Change the rootLogger

log4j.rootLogger=info,syslog

and add

#syslog
log4j.appender.syslog=org.apache.log4j.net.SyslogAppender
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.syslogHost=localhost
log4j.appender.syslog.facility=user

The SyslogAppender uses default port 514, which cannot be changed, and UDP, which cannot be changed either. So make sure in your rsyslog.conf that you have uncommented the lines

$ModLoad imudp
$UDPServerRun 514

Check SyslogAppender to find out more parameters to set, like facility.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .