From ba319f76a5e1c3b3ecba23ebfe466afb1f92e6e7 Mon Sep 17 00:00:00 2001
From: Andrea Dell'Amico <andrea.dellamico@isti.cnr.it>
Date: Mon, 6 Jan 2020 17:00:19 +0100
Subject: [PATCH] php fpm pool: Log the remote client IP address correctly.

---
 library/centos/roles/php-fpm/templates/php-fpm-pool.conf.j2 | 1 +
 library/roles/php-fpm/templates/php-fpm-pool.conf.j2        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/library/centos/roles/php-fpm/templates/php-fpm-pool.conf.j2 b/library/centos/roles/php-fpm/templates/php-fpm-pool.conf.j2
index 22817dbe..ce102751 100644
--- a/library/centos/roles/php-fpm/templates/php-fpm-pool.conf.j2
+++ b/library/centos/roles/php-fpm/templates/php-fpm-pool.conf.j2
@@ -199,6 +199,7 @@ access.log = /var/log/php-fpm/$pool-access.log
 ;
 ; Default: "%R - %u %t \"%m %r\" %s"
 ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
+access.format = "%{REMOTE_ADDR}e - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
 
 ; The timeout for serving a single request after which the worker process will
 ; be killed. This option should be used when the 'max_execution_time' ini option
diff --git a/library/roles/php-fpm/templates/php-fpm-pool.conf.j2 b/library/roles/php-fpm/templates/php-fpm-pool.conf.j2
index c9362ed6..8e94601a 100644
--- a/library/roles/php-fpm/templates/php-fpm-pool.conf.j2
+++ b/library/roles/php-fpm/templates/php-fpm-pool.conf.j2
@@ -193,6 +193,7 @@ access.log = /var/log/php-fpm/$pool-access.log
 ;
 ; Default: "%R - %u %t \"%m %r\" %s"
 ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
+access.format = "%{REMOTE_ADDR}e - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
 
 ; The timeout for serving a single request after which the worker process will
 ; be killed. This option should be used when the 'max_execution_time' ini option