Commit 3dad6ecf authored by mig5's avatar mig5 Committed by mig5

working on adding a log directory to split apache logs

parent 0896635d
......@@ -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.
*/
......
......@@ -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";
}
?>
......
......@@ -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.
......
......@@ -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');
......
......@@ -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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment