Hello,

I'm trying to implement remote logging for my application which is running
in a docker container.
The remote server provider is Papertrail.
I want to specify a custom local host name, currently it is taking
container id, which I don't want.
In syslog layout GitHub link
https://github.com/apache/logging-log4j2/blob/2.x/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java#L126-L129
It has a localHostname property or field, which is taking the value from org
.apache.logging.log4j.core.util.NetUtils.getLocalHostname().
How to set this attribute.
My current implementation is as follows
AppenderComponentBuilder appenderBuilder = builder.newAppender("syslog",
"Syslog")
        .addAttribute("protocol", "UDP")
        .addAttribute("host", host)
        .addAttribute("port", port)
        .addAttribute("appName", serviceName)
        .addAttribute("id", serviceName)
        .addAttribute("facility", "LOCAL0")
        .addAttribute("newLine", true)
        .addAttribute("format", "RFC5424")
        .addAttribute("ignoreExceptions", false);

I'm ok to use SocketAppender as well if syslog appender doesn't support
this.

Thank you,

Ganesh S

Reply via email to