Logging to Graylog missing servername

HAProxy version 2.8.7-1ppa1~jammy 2024/03/02 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2028.
Known bugs: http://www.haproxy.org/bugs/bugs-2.8.7.html
Running on: Linux 5.15.0-101-generic #111-Ubuntu SMP Tue Mar 5 20:16:58 UTC 2024 x86_64

Hi all,

I was trying to send haproxy logs to our new graylog server, but I am getting a dash - in the graylog for the server name, which is our Haproxy.

Looking at the logs in /var/log/haproxy.log I see the servername in the log.

The part for sending logs is this:

global
log /dev/log local0 debug
log /dev/log local1 notice
log graylogcl.domain.com:1514 format rfc5424 local2 info

Looking at the partial full message output in graylog for this problematic server where server name should be looks like this:

full_message
<150>1 2024-07-01T17:44:47.279519+02:00 - haproxy 1734411 - -

From our other working haproxy servers I get the server name in the graylog:

full_message
<150>1 2024-07-01T17:44:47.286379+02:00 servername haproxy 20001 - -

hostname, hostnamectl commands in Ubuntu return expected server names.

Graylog input is Syslog UDP.

Does anyone have any suggestions?

Regards,
Igor

By default haproxy sets the log-tag to “haproxy” (which corresponds to what you see on the logline after the dash).

To set the syslog hostname, you must explicitly use log-send-hostname

Hope this helps

Hey @adarragon thanks for the reply. This solves the problem partially since if I put log-send-hostname parameter in global section then haproxy stops logging to /var/log/haproxy.log.

If I remove log-send-hostname the local logging is restored.

Any thoughts?

Thanks,
Igor