[Ovirt-devel] [PATCH] Using log rotation to minimize writing to the managed node filesystem.
Darryl L. Pierce
dpierce at redhat.com
Fri Jun 27 18:47:20 UTC 2008
From: Darryl Pierce <dpierce at redhat.com>
First draft of this. I'm still continuing to run the managed node to see what other files are
growing over time.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
ovirt-host-creator/common-pkgs.ks | 1 +
ovirt-host-creator/common-post.ks | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/ovirt-host-creator/common-pkgs.ks b/ovirt-host-creator/common-pkgs.ks
index 8d0ba70..2d1ad6e 100644
--- a/ovirt-host-creator/common-pkgs.ks
+++ b/ovirt-host-creator/common-pkgs.ks
@@ -26,6 +26,7 @@ augeas
nc
bind-utils
syslinux
+cronie
hal
ovirt-managed-node
-policycoreutils
diff --git a/ovirt-host-creator/common-post.ks b/ovirt-host-creator/common-post.ks
index 723b838..300bc3c 100644
--- a/ovirt-host-creator/common-post.ks
+++ b/ovirt-host-creator/common-post.ks
@@ -12,6 +12,30 @@ cat > /etc/sysconfig/iptables << \EOF
COMMIT
EOF
+echo "Setting up log rotation"
+cat > /etc/logrotate.d/ovirt << \EOF
+/var/log/*.log {
+ rotate 0
+ missingok
+ notifempty
+ size=10k
+}
+EOF
+
+echo "Creating the hourly rotation file"
+cat > /etc/cron.hourly/ovirt-rotatelog" << \EOF
+#!/bin/sh
+
+/usr/sbin/logrotate /etc/logrotate.d/ovirt
+
+EXITVALUE=$?
+if [ $EXITVALUE != 0 ]; then
+ /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
+fi
+exit 0
+EOF
+chmod +x /etc/cron.hourly/ovirt-rotatelog
+
echo "Writing ovirt-functions script"
# common functions
cat > /etc/init.d/ovirt-functions << \EOF
--
1.5.5.1
More information about the ovirt-devel
mailing list