diff --git a/templates/vhost.conf b/templates/vhost.conf
index 2d241f14b529094ceafa560f9bb40517f98333b1..18089ebce3ce55d16f321684b6eacbfa2ea2ae45 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