smpallen99 / syslog

Elixir logger syslog backend
MIT License
40 stars 22 forks source link

localhost is used instead of the machine name in the logs #22

Open pallix opened 5 years ago

pallix commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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