Commit a7211c41 authored by Matt Corks's avatar Matt Corks

This is the patch which requires being able to save to the server context.

It should be merged with mig5's branch for other webserver log handling development.
Since it's unclear (to me) how to read or write these data the above is mostly
placeholders waiting until someone who actually understands this turns this
into something useful.
parent 20f83afa
......@@ -27,6 +27,11 @@ Include <?php print $http_vhostd_path ?>
# platforms
Include <?php print $http_platformd_path ?>
# logs
## Note: Aegir has been configured to assume that these logs are rotated once every <?php print $http_log_rotation_frequency ?> day(s)
## TODO use the log directory and log format set via the frontend
## CustomLog <?php print $http_log_format ?> <?php print $http_logd_path ?>/<?php print $http_log_name ?>
# other configuration, not touched by aegir
# this allows to have default (for example during migrations) that are eventually overriden by aegir
Include <?php print $http_postd_path ?>
......
......@@ -63,6 +63,16 @@ class provisionService_http_public extends provisionService_http {
$data['http_postd_path'] = $this->server->http_postd_path;
$data['http_platformd_path'] = $this->server->http_platformd_path;
$data['http_vhostd_path'] = $this->server->http_vhostd_path;
$data['http_logd_path'] = $this->server->http_logd_path;
$data['http_log_name'] = $this->server->http_log_name;
$data['http_log_rotation_frequency'] = $this->server->http_log_rotation_frequency;
$data['http_log_format_name'] = $this->server->http_log_format_name;
// default: apache common log format with vhost prepended
$data['http_log_format'] = "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"";
// @TODO use http_log_format_name to set the http_log_format
// in order for statistics collection to work, each name must correspond
// to an allowed option for the --pattern argument of provision_bwstats,
// meaning that a regex which can parse it is defined in that module.
}
$data['http_port'] = $this->server->http_port;
......@@ -114,6 +124,10 @@ class provisionService_http_public extends provisionService_http {
$this->server->http_postd_path = "{$app_dir}/post.d";
$this->server->http_platformd_path = "{$app_dir}/platform.d";
$this->server->http_vhostd_path = "{$app_dir}/vhost.d";
$this->server->http_logd_path = "{$app_dir}/log.d";
$this->server->http_log_name = preg_replace('/[^-A-Za-z0-9_.]/', '', $this->server->name).'.log';
$this->server->http_log_rotation_frequency = 1; # specify number of days
$this->server->http_log_format_name = "host+clf"; // common log format with vhost prepended
}
}
......@@ -143,6 +157,11 @@ class provisionService_http_public extends provisionService_http {
$this->sync($this->server->http_vhostd_path, array(
'exclude' => $this->server->http_vhostd_path . '/*', // Make sure remote directory is created
));
provision_file()->create_dir($this->server->http_logd_path , dt("Webserver logs"), 0700);
$this->sync($this->server->http_logd_path, array(
'exclude' => $this->server->http_logd_path . '/*', // Make sure remote directory is created
));
}
parent::verify_server_cmd();
......
......@@ -80,7 +80,12 @@ if ($server->nginx_has_upload_progress) {
client_body_temp_path /var/lib/nginx/body 1 2;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log crit;
## Note: Aegir has been configured to assume that these logs are rotated once every <?php print $http_log_rotation_frequency ?> day(s)
## @TODO use the log directory set via frontend: <?php print $http_logd_path ?>
## @TODO use the log format set via the frontend: <?php print $http_log_format ?>
## @TODO use the log filename set via the frontend: <?php print $http_log_name ?>
#######################################################
### nginx default server
......
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