Este conteúdo não está disponível no idioma selecionado.
5.7. Logging HAProxy Messages to rsyslog
You can configure your system to log HAProxy messages to
rsyslog by writing to the /dev/log socket. Alternately you can target the TCP loopback address, however this results in slower performance.
The following procedure configures HAProxy to log messages to
rsyslog.
- In the
globalsection of the HAProxy configuration file, use thelogdirective to target the/dev/logsocket.log /dev/log local0
log /dev/log local0Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Update the
frontend,backend, andlistenproxies to send messages to thersyslogservice you configured in theglobalsection of the HAProxy configuration file. To do this, add alog globaldirective to thedefaultssection of the configuration file, as shown.defaults log global option httplogdefaults log global option httplogCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you are running HAProxy within a
chrootedenvironment, or you let HAProxy create achrootdirectory for you by using thechrootconfiguration directive, then the socket must be made available within thatchrootdirectory. You can do this by modifying thersyslogconfiguration to create a new listening socket within thechrootfilesystem. To do this, add the following lines to yourrsyslogconfiguration file.$ModLoad imuxsock $AddUnixListenSocket PATH_TO_CHROOT/dev/log
$ModLoad imuxsock $AddUnixListenSocket PATH_TO_CHROOT/dev/logCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To customize what and where HAProxy log messages will appear, you can use
rsyslogfilters as described in Basic Configuration of Rsyslog in the System Administrator's Guide.