diff --git a/syslog/manifests/init.pp b/syslog/manifests/init.pp index 9dcd454..bf6e1ff 100644 --- a/syslog/manifests/init.pp +++ b/syslog/manifests/init.pp @@ -36,6 +36,18 @@ class syslog::common { } } + case $kernel { + "linux": { + file { "/etc/logrotate.d/syslog.all": + ensure => present, + mode => 0644, + owner => "root", + group => "root", + content => template("syslog/logrotate.erb"), + } + } + } + } # Install syslog client @@ -193,6 +205,14 @@ class syslog::common::standalone inherits syslog::common { target => "/srv/log/all.log", } + case $kernel { + "linux": { + File["/etc/logrotate.d/syslog.all"] { + ensure => absent, + } + } + } + file { "/usr/local/sbin/logarchiver.sh": ensure => present, source => "puppet:///modules/syslog/logarchiver.sh", diff --git a/syslog/templates/logrotate.erb b/syslog/templates/logrotate.erb new file mode 100644 index 0000000..ed2c682 --- /dev/null +++ b/syslog/templates/logrotate.erb @@ -0,0 +1,7 @@ +/var/log/all.log { + create 0640 root <%= syslog_group %> + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +}