How can I Forward Real User IP + CloudFlare IP in access logs

Hi,

I have tried to follow this setup: https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-

But once I set the real_ip_header for ‘CF-Connecting-IP’ or ‘X-Forwarded-For’ I just get the internal container IP for each request.

Example of current result:

172.19.0.3 - - [03/Feb/2019:09:47:59 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 78 

Expected result:

CloudFlareIP - ClientIP - [03/Feb/2019:09:47:59 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 78 
198.41.242.84 - 0.0.0.0 - [03/Feb/2019:09:47:59 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 78 

My guess is that those requests are handled by Apache but I just can’t think about a solution on how to forward the Client IP + CloudFlare IP in the access logs.

If anyone can help me out I would really appreciate it, thanks!