If you connect load balancers to your AxoSyslog application, AxoSyslog identifies every connection that is connected to the load balancers identically by default, regardless of the source IP or the source protocol. Essentially, the load balancer masks the source IP unless you enable Proxy Protocol support for your proxy TLS transport() to inject information about the original connection into the forwarded TCP session.
For further details about the working mechanism behind the Proxy Protocol support on AxoSyslog and the configuration details, see the following sections:
1 - The working mechanism behind the Proxy Protocol
This section describes how AxoSyslog supports the Proxy Protocol.
The working mechanism behind the Proxy Protocol
When using the Proxy Protocol during load balancing, AxoSyslog detects the information behind connections connected to the load balancer, then parses the injected information into the following macros:
Data
Macro in version 4.9 and earlier
Version 4.10 and later
Source IP of the proxy
PROXY_SRCIP
SOURCEIP
Source port of the proxy
PROXY_SRCPORT
SOURCEPORT
Destination IP of the proxy
PROXY_DSTIP
DESTIP
Destination port of the proxy
PROXY_DSTPORT
DESTPORT
Note
Consider the following about macros and headers:
When the proxy protocol header is PROXY UNKNOWN, no additional macros are added.
When AxoSyslog cannot parse a proxy protocol header, the connection is closed:
Note
Originally, the driver supported version 1 of the PROXY protocol (TCP4, TCP6, and TLS connections). PROXY protocol v2 support is available in AxoSyslog version 4.1 and later. UDP transport support for PROXY protocol v2 (proxied-udp) is available in version 4.25 and later.
2 - Proxy Protocol: configuration and output examples
This section provides information about enabling Proxy Protocol support in your network() source options, and an example configuration and output to illustrate how the Proxy Protocol method works in AxoSyslog.
Enabling Proxy Protocol support for your network() source options
Unless you enable Proxy Protocol support for your network() source, AxoSyslog identifies every connection that is connected to the load balancers identically by default, regardless of the source IP or the source protocol.
To enable Proxy Protocol for your network() source, set the transport() parameter of your network() source to proxied-tcp, proxied-tls-passthrough, or proxied-udp, depending on your preference and configuration.
proxied-tls can be used in complex MITM (man in the middle) configurations, where the proxy header is sent encrypted within the same TLS session as the proxied messages.
When you enable Proxy Protocol support for your network() source, you can use the following configuration example with your AxoSyslog application.
Configuration
The following code sample illustrates how you can use the Proxy Protocol in your AxoSyslog configuration (using the transport() parameter set to proxied-tls-passthrough).
With this configuration, the Proxy Protocol method will perform injecting the information of the original connection into the forwarded TCP session, based on the working mechanism described in The working mechanism behind the Proxy Protocol.
The following example illustrates how the parsed macros will appear in the output.
Example: Output for the PROXY TCP4 192.168.1.1 10.10.0.1 1111 2222 input header
With the PROXY TCP4 192.168.1.1 10.10.0.1 1111 2222 input header, the output looks like this:
Note that the macros that AxoSyslog adds to the message appear in the output.
Enabling Proxy Protocol v2 support over UDP
Available in AxoSyslog version 4.25 and later.
To receive UDP syslog messages from a load balancer that injects HAProxy Proxy Protocol v2 headers, set transport("proxied-udp") on your network() or syslog() source.
Noteproxied-udp supports HAProxy Proxy Protocol version 2 only. Proxy Protocol v1 is not supported over UDP.
Using the network() driver (BSD syslog/RFC3164 format):
After parsing, the original client address and port are available as ${SOURCEIP}, ${SOURCEPORT}, ${DESTIP}, and ${DESTPORT} macros, the same as for TCP-based proxied transports.