Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Created July 29, 2022 15:11
Show Gist options
  • Save haproxytechblog/4640068b8720064181ee876bf948f2c0 to your computer and use it in GitHub Desktop.
Save haproxytechblog/4640068b8720064181ee876bf948f2c0 to your computer and use it in GitHub Desktop.
Log Forwarding with HAProxy and Syslog
log-forward syslog
# Accepts incoming TCP messages
bind 0.0.0.0:514
# Accepts incoming UDP messages
dgram-bind 0.0.0.0:514
# Sends outgoing messages via UDP
log 172.25.0.12:514 local0
log-forward syslog
bind 0.0.0.0:514
dgram-bind 0.0.0.0:514
log ring@logbuffer local0
ring logbuffer
description "buffer for logs"
format rfc5424
maxlen 1200
size 32764
timeout connect 5s
timeout server 10s
# Sends outgoing messages via TCP
server logserver 172.25.0.12:514 check
@garutialle
Copy link

Hi, I'm trying this configuration, the problem I have is that the logs to the syslog all come to me with the IP address of the haproxy machine and host host_from etc... and I can't find an option to pass the IP address of the client that works with log- forward

@NickMRamirez
Copy link

Certainly, it could be that the log-forward section does not yet have a feature to preserve the client IP, but could be worthwhile to add it as a feature request on the HAProxy GitHub.

@garutialle
Copy link

Sorry but it makes little sense that you don't send any identifier of the machine that will generate the log. if I activate syslog on 4 switches for example and I want to use haproxy as reverse and cache forward towards my syslog do I need to know which switch generated the log?

@tuxillo
Copy link

tuxillo commented Aug 22, 2024

Did you find any solution to the originating source IP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment