There are two parts to this solution. The first part is the proxy needs to be configured to foward the IP address to Apache. The second part is that Apache needs to save the X-Forwarded-for header into the log.
On the proxy:
Ensure that "X-forwarded-for" header is added. For more information on how to do this please see 000010319.
On the APACHE server log format:
Use custom format string: