From 7c071c8e5953922040175c9bfdb458effb982847 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 21 Jul 2015 11:00:50 -0400 Subject: Fix leap-mx logrotation to work with twistd (#7058) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't want to try and create the log file, twistd will do that. Don’t rename the log file from mx.log to mx.log.0, instead just copy it to mx.log.1, and then clear out mx.log so it’s empty (this is needed because leap-mx might assume that its file descriptor is still valid and continue trying to write to it, without this, leap-mx might lose data because it’ll assume the original log file is still around and continue to write to it, even though it’s gone)It’s a little dangerous because it’s possible that you might lose some logged data between the time that logrotate copies the new log file and truncates the old file (Caveat administrator). Finally, we don't want logrotate to complain if it finds mx.log, its ok if its there. Change-Id: I9952627f4d47e7a89a2915f6b72d82f9e6ca0d8b --- puppet/modules/leap_mx/manifests/init.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/puppet/modules/leap_mx/manifests/init.pp b/puppet/modules/leap_mx/manifests/init.pp index 2986f622..284662d2 100644 --- a/puppet/modules/leap_mx/manifests/init.pp +++ b/puppet/modules/leap_mx/manifests/init.pp @@ -83,9 +83,11 @@ class leap_mx { 'set file /var/log/leap/mx.log', 'set rotate 5', 'set schedule daily', + 'clear nocreate', + 'rm create', + 'rm ifempty', 'set compress compress', 'set missingok missingok', - 'set ifempty notifempty', 'set copytruncate copytruncate' ] } -- cgit v1.2.3