How can I add x-forwarded-for in Apache error log file?

I have 2 servers with Apache 2.2 and LB (NetScaler),

I can see the client IP by using x-forwarded-for in access log but I do not see it in error log,

Is there any way to add x-forwarded-for in error log file?


In apache 2.2 you cannot change the error log format like ThatGremeGuy mentioned and his solution would be the best.

In 2.4 you can change it

http://httpd.apache.org/docs/2.4/logs.html#errorlog


You cannot change the format of the error log, but you can use mod_rpaf to log the client IP instead of the proxy (LB) IP.