This is just to add some addition info I found that might be of help for anyone reading this post: it's about logging behind a proxy server. It has some problems as X-Forwarded-For can have multiple ip addresses. If anyone knows how to solve this I would be grateful.
I do my logging this way as opposed to apache's suggestion just to change the %h because I was unsure what would happen to my logs if the X-Forwarded-For was not set (eg if a local request was made from/to the server say via a cgi script).
Code:
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%v:%p %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" log_x_forward_for
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" is-forwarder
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined env=!is-forwarder
CustomLog /var/log/apache2/other_vhosts_access.log log_x_forward_for env=is-forwarder
hope it help
Stephen