I am using an AWS AutoScaling Group. Here i have hosted Apche-Ubuntu instances. I want to log which server served the content, by logging its ip.
Closest I have found is this https://ubuntuforums.org/archive/index.php/t-1401710.html (February 11th, 2010, 04:07 PM) comment.
In Apache you can use the directive LogFormat which allows you to determine what information is included in the header of each log. You create LogFormat strings in the apache2.conf, then use those strings when you use the CustomLog directive.
Example used in the Apache help:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/access_log" common
This means that the logs in access_log will have this information included:
In the log formats documentation there is a %A - Local IP-address
I have never tested it, but it might work for what you need.