summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/logrotate.pp39
-rw-r--r--templates/vhost-default.conf.erb1
2 files changed, 40 insertions, 0 deletions
diff --git a/manifests/logrotate.pp b/manifests/logrotate.pp
new file mode 100644
index 0000000..c9bad6d
--- /dev/null
+++ b/manifests/logrotate.pp
@@ -0,0 +1,39 @@
1# == Class: httpd::logrotate
2#
3class httpd::logrotate (
4 $options = [
5 'daily',
6 'missingok',
7 'rotate 30',
8 'compress',
9 'delaycompress',
10 'notifempty',
11 'create 640 root adm',
12 ],
13 $prerotate = [
14 "if [ -d /etc/logrotate.d/${::httpd::params::apache_name}-prerotate ]; then \\",
15 " run-parts /etc/logrotate.d/${::httpd::params::apache_name}-prerotate; \\",
16 'fi; \\',
17 ],
18 $postrotate = [
19 "if service ${::httpd::params::apache_name} status > /dev/null ; then \\",
20 " service ${::httpd::params::apache_name} reload > /dev/null; \\",
21 'fi; \\',
22 ],
23 $firstaction = 'undef',
24 $lastaction = 'undef',
25) inherits httpd::params {
26 include ::logrotate
27
28 $apache_logdir = "/var/log/${::httpd::params::apache_name}"
29 $logrotate_name = $::httpd::params::apache_name
30
31 ::logrotate::file { $logrotate_name:
32 log => "${apache_logdir}/*.log",
33 options => $options,
34 prerotate => $prerotate,
35 postrotate => $postrotate,
36 firstaction => $firstaction,
37 lastaction => $lastaction,
38 }
39}
diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb
index e9d2d77..fdc8336 100644
--- a/templates/vhost-default.conf.erb
+++ b/templates/vhost-default.conf.erb
@@ -17,6 +17,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
17 AllowOverride None 17 AllowOverride None
18 Order allow,deny 18 Order allow,deny
19 allow from all 19 allow from all
20 Satisfy any
20 </Directory> 21 </Directory>
21 ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log 22 ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log
22 LogLevel warn 23 LogLevel warn