Syslog Appender: Short Host Name

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Syslog Appender: Short Host Name

Luke Bond
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 (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!