diff --git a/http/apache/apache_service.inc b/http/apache/apache_service.inc index bf5dc218aafed84a62557c97224e39435c6ed49e..300578622fe6afad5d3879a16b554b0bbb85f368 100644 --- a/http/apache/apache_service.inc +++ b/http/apache/apache_service.inc @@ -3,11 +3,16 @@ class provisionService_http_apache extends provisionService_http_public { protected $application_name = 'apache'; protected $has_restart_cmd = TRUE; + protected $has_log_directory = TRUE; function default_restart_cmd() { return provisionService_http_apache::apache_restart_cmd(); } + function default_log_directory() { + return provisionService_http_apache::apache_log_directory(); + } + function cloaked_db_creds() { return TRUE; } @@ -47,6 +52,21 @@ class provisionService_http_apache extends provisionService_http_public { return "sudo $command graceful"; } + public static function apache_log_directory() { + $log_directory = '/var/log/apache2'; #debian/ubuntu + $options[] = '/var/log/apache'; #centos? + $options[] = '/var/log/httpd'; #redhat/centos ? + $options[] = $log_directory; + + foreach ($options as $test) { + if(is_dir($test)) { + $log_directory = $test; + break; + } + } + return $log_directory; + } + /** * Restart apache to pick up the new config files. */ diff --git a/http/apache/vhost.tpl.php b/http/apache/vhost.tpl.php index bc29d5217b03bf79f45fda4f0878ca8fc0826483..8d8e063ebe1c06d20c3e0643d24357d5a2510836 100644 --- a/http/apache/vhost.tpl.php +++ b/http/apache/vhost.tpl.php @@ -42,6 +42,10 @@ if ($this->redirection || $ssl_redirection) { print " RewriteRule ^/*(.*)$ http://{$this->uri}/$1 [L,R=301]\n"; } } + +if ($this->split_logfiles) { + print " CustomLog " . $http_log_directory . "/" . $this->uri . ".log combined"; +} ?> diff --git a/http/http.drush.inc b/http/http.drush.inc index 3f12b56cf6565383b31307f798bf775842766037..737a0197026dd3dfe2c3ef2131877af4fb7fd310 100644 --- a/http/http.drush.inc +++ b/http/http.drush.inc @@ -67,6 +67,8 @@ class provisionService_http_public extends provisionService_http { $data['http_port'] = $this->server->http_port; + $data['http_log_directory'] = $this->server->http_log_directory; + // We assign this generic catch all for standard http. // The SSL based services will override this with the // correct ip address. diff --git a/provision.context.site.inc b/provision.context.site.inc index 397e312cca9bedaeaf712429fc6e751d7905b2f3..6060cac0ddc96ebdf38663e21798e0c07b8a29d4 100644 --- a/provision.context.site.inc +++ b/provision.context.site.inc @@ -35,6 +35,7 @@ class provisionContext_site extends provisionContext { $this->setProperty('client_email'); $this->setProperty('aliases', array(), TRUE); $this->setProperty('redirection', FALSE); + $this->setProperty('split_logfiles', FALSE); // this can potentially be handled by a Drupal sub class $this->setProperty('profile', 'default'); diff --git a/provision.service.inc b/provision.service.inc index 92ecd725b94774a55078567d10d468726ee36f4c..b882dfefbb4154cabaf529dfaa89d4dc829f79c8 100644 --- a/provision.service.inc +++ b/provision.service.inc @@ -14,6 +14,7 @@ class provisionService extends provisionChainedState { protected $has_restart_cmd = FALSE; protected $has_port = FALSE; + protected $has_log_directory = FALSE; protected $configs = array(); @@ -49,6 +50,9 @@ class provisionService extends provisionChainedState { if ($this->has_restart_cmd) { $this->server->setProperty($this->service . '_restart_cmd', $this->default_restart_cmd()); } + if ($this->has_log_directory) { + $this->server->setProperty($this->service . '_log_directory', $this->default_log_directory()); + } } return TRUE; } @@ -70,6 +74,10 @@ class provisionService extends provisionChainedState { return false; } + function default_log_directory() { + return false; + } + /** * Set the currently active configuration object. *