[Ovirt-devel] [PATCH node] Fix log rotation.

Darryl L. Pierce dpierce at redhat.com
Wed Mar 18 18:35:33 UTC 2009


From: Darryl Pierce <dpierce at redhat.com>

Removes /var/log/messages from the configuration file. Sets the log
rotation to take place every 10 minutes.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 Makefile.am                    |    2 +-
 logrotate/ovirt-logrotate      |   12 +++---------
 logrotate/ovirt-logrotate.conf |    2 +-
 ovirt-node.spec.in             |    5 +++--
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index af23ae4..e9ae52c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,7 +49,7 @@ EXTRA_DIST =			\
   scripts/ovirt-uninstall-node-stateful	\
   kinit/ovirt-kinit		\
   logrotate/ovirt-logrotate	\
-  logrotate/ovirt-logrotate.conf
+  logrotate/ovirt-logrotate.conf 
 
 DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz
 
diff --git a/logrotate/ovirt-logrotate b/logrotate/ovirt-logrotate
index a6a394d..a61af6f 100644
--- a/logrotate/ovirt-logrotate
+++ b/logrotate/ovirt-logrotate
@@ -1,9 +1,3 @@
-#!/bin/sh
-
-/usr/sbin/logrotate /etc/logrotate.d/ovirt-logrotate.conf
-
-EXITVALUE=$?
-if [ $EXITVALUE != 0 ]; then
-    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
-fi
-exit $EXITVALUE
+# Run each log rotation every 10 minutes
+*/10 * * * * root /usr/sbin/logrotate /etc/logrotate.d/ovirt-logrotate.conf
+*/10 * * * * root /usr/sbin/logrotate /etc/logrotate.d/syslog
diff --git a/logrotate/ovirt-logrotate.conf b/logrotate/ovirt-logrotate.conf
index f1de67a..8747f59 100644
--- a/logrotate/ovirt-logrotate.conf
+++ b/logrotate/ovirt-logrotate.conf
@@ -1,4 +1,4 @@
-/var/log/ovirt*.log /var/log/messages {
+/var/log/ovirt*.log {
     rotate 3
     compress
     delaycompress
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 5cb7318..02e90ce 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -138,6 +138,7 @@ cd -
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/chkconfig.d
 %{__install} -d -m0755 %{buildroot}%{_initrddir}
 %{__install} -d -m0755 %{buildroot}%{app_root}
+%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d
 
@@ -176,7 +177,7 @@ cd -
 
 %{__install} -p -m0755 kinit/ovirt-kinit %{buildroot}%{_sysconfdir}/cron.hourly
 
-%{__install} -p -m0755 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.hourly
+%{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.d
 %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d
 
 echo "oVirt Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release
@@ -316,7 +317,7 @@ fi
 %{_initrddir}/ovirt-post
 %config %{_sysconfdir}/cron.hourly/ovirt-kinit
 %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf
-%config %{_sysconfdir}/cron.hourly/ovirt-logrotate
+%config %{_sysconfdir}/cron.d/ovirt-logrotate
 %{_sysconfdir}/ovirt-config-boot.d
 %{_sysconfdir}/ovirt-config-setup.d
 
-- 
1.6.0.6




More information about the ovirt-devel mailing list