# Log to different files with different backends in ONE frontend

**URL:** <https://discourse.haproxy.org/t/log-to-different-files-with-different-backends-in-one-frontend/2985>\
**Category:** Help!\
**Created:** [September 12, 2018, 11:26am UTC](https://discourse.haproxy.org/t/log-to-different-files-with-different-backends-in-one-frontend/2985 "2018-09-12T11:26:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.scheer](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@thomas.scheer](https://discourse.haproxy.org/u/thomas.scheer)\
**Post date:** [September 12, 2018, 11:26am UTC](https://discourse.haproxy.org/t/log-to-different-files-with-different-backends-in-one-frontend/2985/1 "2018-09-12T11:26:57Z")

</div>

A short description of the setup:

I have two serverfarms which differs in name (server1.domain and server2.domain) but shares the same frontend (with ssl certificate and same port) …  
So the traffic is routed to the backends with

frontend incoming  
bind \*:443 ssl crt /usr/local/etc/haproxy/cert/server.pem  
mode http

# Use backend “backend\_linux” for “linux.” host.

# Use backend “backend\_windows” for “windows.” host.

```
acl host_linux hdr_beg(host) -i linux.
acl host_windows hdr_beg(host) -i windows.

use_backend backend_linux if host_linux
use_backend backend_windows if host_windows
default_backend backend_linux

```

Want I now want to have is a different logfile (using rsyslog) for each server-farm… like

log 127.0.0.1 local1 debug if host\_linux  
log 127.0.0.1 local2 debug if host\_windows  
(this is NOT possible in the current version)

BUT is there any other solution for that problem except to splitt the incoming traffic to two frontends ?

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [September 12, 2018, 11:47am UTC](https://discourse.haproxy.org/t/log-to-different-files-with-different-backends-in-one-frontend/2985/2 "2018-09-12T11:47:10Z")

</div>

Logging configuration is not necessarily global, you can also configure it per section, however, frontend logging configuration will log the connection, backend logging is only used for server status changes.

Meaning, you can log connections to different syslog servers based on different frontends, however, in this content-switching configuration it is not trivially possible.

A reiteration through another layer frontend/backend layer is possible, so that you have 2 second level frontends that are dedicated to either linux or windows host and can therefor have distinct logging configurations.
