I have set up an input in Graylog that is supposed to collect log data from a HAProxy machine via rsyslog.
Have successfully set up similar log inputs in Graylog for gathering logs from other services such as Apache and MariaDB, but specifically for HAProxy, I see the proxy machine going haywire when I enable the rsyslog config for sending logs to Graylog over UDP.
By ‘haywire’ what I mean is that the proxy server starts rapidly writing lines such as the following, to /var/log/haproxy.log file:
Proxy01 haproxy Nov 18 16:30:59 Proxy01 haproxy Nov 18 16:30:59 ...
Within a short while, the root partition had filled up due to this particular log file having grown to several gigabytes in size.
On the HAProxy, I have these two config files in /etc/rsyslog.d/ where the first one:
/etc/rsyslog.d/10-graylog_haproxy.conf (custom rsyslog config created by me, for forwarding HAProxy logs to Graylog):
*.*@192.168.5140;RSYSLOG_SyslogProtocol23Format module(load="imfile" PollingInterval="10") # File 1 input(type="imfile" File="/var/log/haproxy.log" Tag="haproxy" Severity="info") if $programname == 'haproxy' then @192.168.:5143
/etc/rsyslog.d/49-haproxy.conf (native rsyslog config created by haproxy installer):
# Create an additional socket in haproxy's chroot in order to allow logging via # /dev/log to chroot'ed HAProxy processes $AddUnixListenSocket /var/lib/haproxy/dev/log # Send HAProxy messages to a dedicated logfile :programname, startswith, "haproxy" { /var/log/haproxy.log stop }
I must admit I have not tried much in terms of fixing the problem, since I don’t really know the cause and am a newbie when it comes to using rsyslog as well as Graylog (although I believe the problem may be with the former).
I have however looked at the graylog server log, but didn’t find anything that I could relate to this issue.
Also had a look at rsyslog service journal on the HAProxy box, and there I just see a whole bunch of entries like this one:
Nov 18 14:22:11 Proxy01 rsyslogd[8446]: message too long (8110) with configured size 8096, begin of message is: Nov 18 14:22:10 DK
I am on the lastest version of Graylog and Elasticsearch (OSS) and both the Graylog server and the HAProxy machines are running Debian 10.
Any help will be greatly appreciated