[SOLVED] Fail2ban - add domain name in log


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:

   log local0

   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?


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.