[SOLVED] Fail2ban - add domain name in log

Hello!

I have 2 web servers behind Haproxy. I would like to “undesired” traffic to those server using fail2ban but on haproxy not on the web servers. I have so enabled haproxy log as follows:

global
   log 127.0.0.1:514 local0

defaults
   log global
   mode http
   option httplog
   option dontlognull

But in the log, I do not have the domain information. Is there a way to add it?

Thx!

Found it :grinning:

I needed to add in the frontend:

http-request capture req.hdr(Host) len 100

and make sure that I have %hr in my custom log format.