From af73e43ec3037c8f2b2f56aa8d391be506b79f69 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Tue, 22 Dec 2020 10:24:17 +0100
Subject: [PATCH] Encapsulate ip in apache access log to cover proxy forwarded
 multiple ips separated by comma and space

---
 templates/vhost.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/vhost.conf b/templates/vhost.conf
index 2d241f1..18089eb 100644
--- a/templates/vhost.conf
+++ b/templates/vhost.conf
@@ -9,7 +9,7 @@
 
   ErrorLog ${APACHE_LOG_DIR}/{{ alerta_domain }}-error.log
   LogLevel warn
-  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
+  LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
   SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
   CustomLog ${APACHE_LOG_DIR}/{{ alerta_domain }}-access.log combined env=!forwarded
   CustomLog ${APACHE_LOG_DIR}/{{ alerta_domain }}-access.log proxy env=forwarded
@@ -46,7 +46,7 @@
 
   ErrorLog ${APACHE_LOG_DIR}/{{ alerta_domain }}-error.log
   LogLevel warn
-  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
+  LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
   SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
   CustomLog ${APACHE_LOG_DIR}/{{ alerta_domain }}-access.log combined env=!forwarded
   CustomLog ${APACHE_LOG_DIR}/{{ alerta_domain }}-access.log proxy env=forwarded
-- 
GitLab