[logback-user] Syslog Appender: Short Host Name

Luke Bond webakaunt at gmail.com
Tue Nov 13 20:01:54 CET 2012


The 3rd party tool that collects and analyzes (syslog) logs is strictly
working in a general syslog layout:

    Nov 12 16:19:57 hostname username: ERROR ..message..

where the hostname should not  be FQDN, but a short name one instead. For
example, instead of "thisserver.xyz.mars" it should just be a "thisserver".
In fact logging from a shell using a "logger" results in a a short host name
by default.

Logback uses a Syslog Converter (
http://www.jarvana.com/jarvana/view/ch/qos/logback/logback-classic/0.9.3/logback-classic-0.9.3-sources.jar!/ch/qos/logback/classic/pattern/SyslogStartConverter.java?format=ok
SyslogStartConverter ) which looks up the host as:

InetAddress.getLocalHost().getHostName()

This returns a FQDN, which breaks the syslog monitor (since it expects it to
be in a short hostname form).

What would be the way to inject my own "SyslogStartConverter" into a Syslog
Appender? Or maybe there is a better/simpler solution that allows to
overwrite this in some way?

Thank you!
-- 
View this message in context: http://old.nabble.com/Syslog-Appender%3A-Short-Host-Name-tp34675141p34675141.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list