Analytic

Thursday, July 11, 2013

Amazon AWS - Changing dynamically Apache Log File name based on Hostname

Change your vhost apache config as follow (the LogFormat writes correct client IPs to log):


LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined_new
CustomLog "|cat >> /shared/log/apache2/`hostname`-access.log" combined_new

No comments: