Skip to content

Instantly share code, notes, and snippets.

Created Oct 29, 2013
Embed
What would you like to do?
<?php
/* adds independant logging for each site.
* INSTALLATION
* ------------------------------------------------------------------
* modify:
* /etc/sysconfig/apache2
* APACHE_SERVER_FLAGS="-DHOST_PRODUCTION -DHOST_WEB1"
* ------------------------------------------------------------------
* Symlinked to the .drush folder eg.
* ln -s /var/aegir/scripts/logging.drush.inc /var/aegir/.drush/
* ------------------------------------------------------------------
*/
function logging_provision_apache_vhost_config($uri, $data) {
$logs = array(
"<IfDefine HOST_WEB1>",
"LogLevel warn" ,
"LogFormat '%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' xff",
"CustomLog /var/log/apache2/WEB1_" . $uri . ".access.log xff" ,
"ErrorLog /var/log/apache2/WEB1_" . $uri . ".error.log",
"</IfDefine>",
"<IfDefine HOST_WEB2>",
"LogLevel warn" ,
"LogFormat '%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' xff",
"CustomLog /var/log/apache2/WEB2_" . $uri . ".access.log xff" ,
"ErrorLog /var/log/apache2/WEB2_" . $uri . ".error.log",
"</IfDefine>",
"<IfDefine HOST_WEB3>",
"LogLevel warn" ,
"LogFormat '%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' xff",
"CustomLog /var/log/apache2/WEB3_" . $uri . ".access.log xff" ,
"ErrorLog /var/log/apache2/WEB3_" . $uri . ".error.log",
"</IfDefine>",
"<IfDefine HOST_WEB4>",
"LogLevel warn" ,
"LogFormat '%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' xff",
"CustomLog /var/log/apache2/WEB4_" . $uri . ".access.log xff" ,
"ErrorLog /var/log/apache2/WEB4_" . $uri . ".error.log",
"</IfDefine>",
" "
);
return $logs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment