Darryl L. Pierce
2008-Jun-27 18:47 UTC
[Ovirt-devel] [PATCH] Using log rotation to minimize writing to the managed node filesystem.
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
Perry N. Myers
2008-Jun-27 18:51 UTC
[Ovirt-devel] [PATCH] Using log rotation to minimize writing to the managed node filesystem.
Darryl L. Pierce wrote:> 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.Two quick comments... How much does cronie and dependencies add to the managed node. (I would hope not much...) And shouldn't this stuff be in the ovirt-host rpm instead of in common-post? Perry> 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-- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|
Darryl L. Pierce
2008-Jun-27 21:33 UTC
[Ovirt-devel] [PATCH] Using log rotation to minimize writing to the managed node filesystem.
From: Darryl Pierce <dpierce at redhat.com> Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- ovirt-host-creator/common-pkgs.ks | 1 + ovirt-managed-node/ovirt-managed-node.spec | 7 +++++++ ovirt-managed-node/src/ovirt-logrotate | 10 ++++++++++ ovirt-managed-node/src/ovirt-logrotate.conf | 11 +++++++++++ 4 files changed, 29 insertions(+), 0 deletions(-) create mode 100755 ovirt-managed-node/src/ovirt-logrotate create mode 100644 ovirt-managed-node/src/ovirt-logrotate.conf 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-managed-node/ovirt-managed-node.spec b/ovirt-managed-node/ovirt-managed-node.spec index ee2f153..d9b44fb 100644 --- a/ovirt-managed-node/ovirt-managed-node.spec +++ b/ovirt-managed-node/ovirt-managed-node.spec @@ -33,6 +33,11 @@ mkdir -p $RPM_BUILD_ROOT/sbin cp ovirt-awake $RPM_BUILD_ROOT/sbin cp ovirt-identify-node $RPM_BUILD_ROOT/sbin +mkdir -p $RPM_BUILD_ROOT/etc/cron.hourly +cp ovirt-logrotate $RPM_BUILD_ROOT/etc/cron.hourly + +mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d +cp ovirt-logrotate.conf $RPM_BUILD_ROOT/etc/logrotate.d %clean rm -rf $RPM_BUILD_ROOT @@ -40,5 +45,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(755,root,root) %doc README NEWS AUTHOR ChangeLog +%config /etc/logrotate.d/ovirt-logrotate.conf +%config /etc/cron.hourly/ovirt-logrotate /sbin/ovirt-awake /sbin/ovirt-identify-node diff --git a/ovirt-managed-node/src/ovirt-logrotate b/ovirt-managed-node/src/ovirt-logrotate new file mode 100755 index 0000000..f0a2dde --- /dev/null +++ b/ovirt-managed-node/src/ovirt-logrotate @@ -0,0 +1,10 @@ +#!/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 0 + diff --git a/ovirt-managed-node/src/ovirt-logrotate.conf b/ovirt-managed-node/src/ovirt-logrotate.conf new file mode 100644 index 0000000..96fb87c --- /dev/null +++ b/ovirt-managed-node/src/ovirt-logrotate.conf @@ -0,0 +1,11 @@ +/var/log/*.log { + rotate 0 + missingok + size=10k +} + +/var/log/messages { + rotate 0 + missingok + size=10k +} -- 1.5.5.1
Darryl L. Pierce
2008-Jul-02 20:46 UTC
[Ovirt-devel] [PATCH] Using log rotation to minimize writing to the managed node filesystem.
From: Darryl Pierce <dpierce at redhat.com> Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- ovirt-host-creator/common-pkgs.ks | 1 + ovirt-managed-node/ovirt-managed-node.spec | 10 ++++++++++ ovirt-managed-node/src/logrotate/ovirt-logrotate | 10 ++++++++++ .../src/logrotate/ovirt-logrotate.conf | 11 +++++++++++ 4 files changed, 32 insertions(+), 0 deletions(-) create mode 100755 ovirt-managed-node/src/logrotate/ovirt-logrotate create mode 100644 ovirt-managed-node/src/logrotate/ovirt-logrotate.conf 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-managed-node/ovirt-managed-node.spec b/ovirt-managed-node/ovirt-managed-node.spec index bd807b1..fa943f5 100644 --- a/ovirt-managed-node/ovirt-managed-node.spec +++ b/ovirt-managed-node/ovirt-managed-node.spec @@ -36,6 +36,8 @@ make %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/chkconfig.d %{__install} -d -m0755 %{buildroot}%{_initrddir} %{__install} -d -m0755 %{buildroot}%{app_root} +%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.hourly +%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node %{buildroot}%{_sbindir} @@ -52,6 +54,9 @@ make %{__install} -p -m0755 scripts/ovirt-setup %{buildroot}%{app_root} +%{__install} -p -m0644 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.hourly +%{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d + %clean %{__rm} -rf %{buildroot} @@ -81,6 +86,8 @@ fi %{_initrddir}/ovirt-post %{_sysconfdir}/kvm-ifup %{_sysconfdir}/dhclient-exit-hooks +%config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf +%config %{_sysconfdir}/cron.hourly/ovirt-logrotate %{app_root}/ovirt-setup %defattr(-,root,root,0644) %{_initrddir}/ovirt-functions @@ -89,5 +96,8 @@ fi %doc README NEWS AUTHOR ChangeLog %changelog +* Wed Jul 02 2008 Darryl Pierce <dpierce at redhat.com> - 0.92 0.2 +- Added log rotation to limit file system writes. + * Mon Jun 30 2008 Perry Myers <pmyers at redhat.com> - 0.92 0.1 - Add in sections of kickstart post, general cleanup diff --git a/ovirt-managed-node/src/logrotate/ovirt-logrotate b/ovirt-managed-node/src/logrotate/ovirt-logrotate new file mode 100755 index 0000000..f0a2dde --- /dev/null +++ b/ovirt-managed-node/src/logrotate/ovirt-logrotate @@ -0,0 +1,10 @@ +#!/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 0 + diff --git a/ovirt-managed-node/src/logrotate/ovirt-logrotate.conf b/ovirt-managed-node/src/logrotate/ovirt-logrotate.conf new file mode 100644 index 0000000..96fb87c --- /dev/null +++ b/ovirt-managed-node/src/logrotate/ovirt-logrotate.conf @@ -0,0 +1,11 @@ +/var/log/*.log { + rotate 0 + missingok + size=10k +} + +/var/log/messages { + rotate 0 + missingok + size=10k +} -- 1.5.5.1