When your app is behind any sort of reverse proxy (like a Load Balancer, API Gateway, CDN, etc), by default, the Apache access log will start showing the proxy’s IP address as the origin instead of the client one.

Most of those proxies append the client IP address to the X-Forwarded-For HTTP header, so we can use it to get the IP into the access log using a CustomLog as seen below:

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}/mywebsite_access.log combined env=!forwarded
CustomLog ${APACHE_LOG_DIR}/mywebsite_access.log proxy env=forwarded

Reference: https://www.techstacks.com/howto/log-client-ip-and-xforwardedfor-ip-in-apache.html