syslog icon indicating copy to clipboard operation
syslog copied to clipboard

localhost is used instead of the machine name in the logs

Open pallix opened this issue 6 years ago • 2 comments

When logging with udp on a syslog server, localhost is used as the hostname in the log instead of the actual machine name. Example of invalid host name:

Jun 11 12:19:55 localhost elixir<0.335.0>: 2019-06-11 12:19:55.420 module=supervisor pid=<0.418.0> [info] : Child Postgrex.Parameters of Supervisor Postgrex.Supervisor started#012Pid: #PID<0.422.0>#012Start Call: Postgrex.Parameters.start_link()

This is due to the pre variable not using the hostname (destructured as _hostname) variable when formatting the output.

pallix avatar Jun 11 '19 12:06 pallix

It makes the actual not compatible with RFC 3164:

The HOSTNAME field will contain only the hostname, the IPv4 address, or the IPv6 address of the originator of the message. The preferred value is the hostname. If the hostname is used, the HOSTNAME field MUST contain the hostname of the device as specified in STD 13

The hostname should be specified.

pallix avatar Jun 11 '19 12:06 pallix

Fixed in https://github.com/pallix/syslog/commit/270155a7eedc2de27c5627cfa3eeacc7a17edb1b

pallix avatar Jun 12 '19 08:06 pallix