[libvirt] [PATCH] Change logrotate to be per-hypervisor logs

Original bug is: https://bugzilla.redhat.com/show_bug.cgi?id=547514 maybe this could be done in slightly different way, possibly more generic, but I think doing a simple split is good enough for now. Change logrotate to be per-hypervisor logs Having a single logrotate configuration file for all hypervisors did not work as logrotate would get confused if an hypervisor not supported on that platform was still listed. Simplest is to split the logrotate as separate per hypervisor files and change the spec file to only install the ones compiled in. * daemon/libvirtd.lxc.logrotate.in daemon/libvirtd.qemu.logrotate.in daemon/libvirtd.uml.logrotate.in: copy and split the original daemon/libvirtd.logrotate.in file * daemon/Makefile.am: update to support the different files * libvirt.spec.in: only install the relevant logrotate configs diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 958a4f6..d429c71 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -25,7 +25,9 @@ EXTRA_DIST = \ libvirtd.sasl \ libvirtd.sysconf \ libvirtd.aug \ - libvirtd.logrotate.in \ + libvirtd.qemu.logrotate.in \ + libvirtd.lxc.logrotate.in \ + libvirtd.uml.logrotate.in \ test_libvirtd.aug \ $(AVAHI_SOURCES) \ $(DAEMON_SOURCES) @@ -177,20 +179,37 @@ remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@ -BUILT_SOURCES += libvirtd.logrotate +LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \ + libvirtd.uml.logrotate -libvirtd.logrotate: libvirtd.logrotate.in +BUILT_SOURCES += $(LOGROTATE_CONFS) + +libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in + sed \ + -e s!\@localstatedir\@!@localstatedir@!g \ + < $< > $@-t + mv $@-t $@ + +libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in + sed \ + -e s!\@localstatedir\@!@localstatedir@!g \ + < $< > $@-t + mv $@-t $@ + +libvirtd.uml.logrotate: libvirtd.uml.logrotate.in sed \ -e s!\@localstatedir\@!@localstatedir@!g \ < $< > $@-t mv $@-t $@ -install-logrotate: libvirtd.logrotate +install-logrotate: $(LOGROTATE_CONFS) mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/ mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/ - $(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd + $(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu + $(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc + $(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml if LIBVIRT_INIT_SCRIPT_RED_HAT install-init: libvirtd.init diff --git a/daemon/libvirtd.logrotate.in b/daemon/libvirtd.logrotate.in deleted file mode 100644 index 0c51fd3..0000000 --- a/daemon/libvirtd.logrotate.in +++ /dev/null @@ -1,9 +0,0 @@ -@localstatedir@/log/libvirt/qemu/*.log @localstatedir@/log/libvirt/uml/*.log @localstatedir@/log/libvirt/lxc/*.log { - weekly - missingok - rotate 4 - compress - delaycompress - copytruncate - minsize 100k -} diff --git a/daemon/libvirtd.lxc.logrotate.in b/daemon/libvirtd.lxc.logrotate.in new file mode 100644 index 0000000..4e7d314 --- /dev/null +++ b/daemon/libvirtd.lxc.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/lxc/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/daemon/libvirtd.qemu.logrotate.in b/daemon/libvirtd.qemu.logrotate.in new file mode 100644 index 0000000..15cf019 --- /dev/null +++ b/daemon/libvirtd.qemu.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/qemu/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/daemon/libvirtd.uml.logrotate.in b/daemon/libvirtd.uml.logrotate.in new file mode 100644 index 0000000..135a37d --- /dev/null +++ b/daemon/libvirtd.uml.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/uml/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/libvirt.spec.in b/libvirt.spec.in index b1c1c99..17102d9 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -668,16 +668,20 @@ fi %{_sysconfdir}/rc.d/init.d/libvirtd %config(noreplace) %{_sysconfdir}/sysconfig/libvirtd %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf -%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/ %if %{with_qemu} %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu %endif %if %{with_lxc} %config(noreplace) %{_sysconfdir}/libvirt/lxc.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc +%endif +%if %{with_uml} +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml %endif %dir %{_datadir}/libvirt/ -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

According to Daniel Veillard on 3/4/2010 7:36 AM:
Original bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=547514
maybe this could be done in slightly different way, possibly more generic, but I think doing a simple split is good enough for now.
Seems easy enough.
+++ b/daemon/Makefile.am @@ -25,7 +25,9 @@ EXTRA_DIST = \ libvirtd.sasl \ libvirtd.sysconf \ libvirtd.aug \ - libvirtd.logrotate.in \ + libvirtd.qemu.logrotate.in \ + libvirtd.lxc.logrotate.in \ + libvirtd.uml.logrotate.in \ test_libvirtd.aug \ $(AVAHI_SOURCES) \ $(DAEMON_SOURCES) @@ -177,20 +179,37 @@ remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@
-BUILT_SOURCES += libvirtd.logrotate +LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \ + libvirtd.uml.logrotate
-libvirtd.logrotate: libvirtd.logrotate.in +BUILT_SOURCES += $(LOGROTATE_CONFS) + +libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in +libvirtd.uml.logrotate: libvirtd.uml.logrotate.in sed \ -e s!\@localstatedir\@!@localstatedir@!g \ < $< > $@-t mv $@-t $@
Not introduced by your patch, but copied and pasted two more times. Unfortunately, POSIX does not define \@ in sed (GNU sed treats it like @, but some others treat it like \\@). Can you guarantee that @localstatedir@ will not expand to any shell metacharacters? Also, automake guarantees that $(localstatedir) will have the same value as @localstatedir@, but without triggering a 'make syntax-check' warning (although we must already be ignoring that particular check). It would probably be better to write: -e 's![@]localstatedir[@]!$(localstatedir)!g' \ as the substitution. Other than that, you have my ACK -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Thu, Mar 04, 2010 at 08:21:05AM -0700, Eric Blake wrote:
According to Daniel Veillard on 3/4/2010 7:36 AM:
Original bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=547514
maybe this could be done in slightly different way, possibly more generic, but I think doing a simple split is good enough for now.
Seems easy enough.
+++ b/daemon/Makefile.am @@ -25,7 +25,9 @@ EXTRA_DIST = \ libvirtd.sasl \ libvirtd.sysconf \ libvirtd.aug \ - libvirtd.logrotate.in \ + libvirtd.qemu.logrotate.in \ + libvirtd.lxc.logrotate.in \ + libvirtd.uml.logrotate.in \ test_libvirtd.aug \ $(AVAHI_SOURCES) \ $(DAEMON_SOURCES) @@ -177,20 +179,37 @@ remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@
-BUILT_SOURCES += libvirtd.logrotate +LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \ + libvirtd.uml.logrotate
-libvirtd.logrotate: libvirtd.logrotate.in +BUILT_SOURCES += $(LOGROTATE_CONFS) + +libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in +libvirtd.uml.logrotate: libvirtd.uml.logrotate.in sed \ -e s!\@localstatedir\@!@localstatedir@!g \ < $< > $@-t mv $@-t $@
Not introduced by your patch, but copied and pasted two more times. Unfortunately, POSIX does not define \@ in sed (GNU sed treats it like @, but some others treat it like \\@). Can you guarantee that @localstatedir@ will not expand to any shell metacharacters? Also, automake guarantees that $(localstatedir) will have the same value as @localstatedir@, but without triggering a 'make syntax-check' warning (although we must already be ignoring that particular check). It would probably be better to write:
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
as the substitution.
Other than that, you have my ACK
Okay, I was afraid at first that the quoting of the expression would defeat make variable substitution, but that works :-) I also fixed the daemon/.gitignore file to list the new generated logrotates and then pushed the patch, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 03/10/2010 03:29 AM, Daniel Veillard wrote:
It would probably be better to write:
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
as the substitution.
Other than that, you have my ACK
Okay, I was afraid at first that the quoting of the expression would defeat make variable substitution, but that works :-)
Make uses textual substitution, and the only escaping it manages are $ expansion and \-newline collapses. '' quoting doesn't come into play until later, when sh is handed the already-substituted string. So it is quite common to see '$(var)' constructs in make, with single rather than double quotes, since then var is treated literally unless it contains an embedded '. It's also common to see GNU make constructs to properly escape embedded ', to provide truly robust make expansion. Yes, that makes make an awful language to master, since there are two levels of quoting to remember since two different tools will be performing expansions. No wonder automake is so complex: automake developers have to be polyglots, to write a perl script that uses m4 to generate makefile snippets containing portable shell code for building C programs. Maintainers of Makefile.am are isolated from a little of this, but it's still useful to know lots of languages. :) -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

hi will it be better provide some configuration in libvirtd.conf or ENV viriable to control the log level of each hypervisor log seperately? such as I want to libvirt will just log errors for lxc, but any messages for qemu, warning, and error message for uml. Regards osier Daniel Veillard wrote:
Original bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=547514
maybe this could be done in slightly different way, possibly more generic, but I think doing a simple split is good enough for now.
Change logrotate to be per-hypervisor logs
Having a single logrotate configuration file for all hypervisors did not work as logrotate would get confused if an hypervisor not supported on that platform was still listed. Simplest is to split the logrotate as separate per hypervisor files and change the spec file to only install the ones compiled in. * daemon/libvirtd.lxc.logrotate.in daemon/libvirtd.qemu.logrotate.in daemon/libvirtd.uml.logrotate.in: copy and split the original daemon/libvirtd.logrotate.in file * daemon/Makefile.am: update to support the different files * libvirt.spec.in: only install the relevant logrotate configs
diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 958a4f6..d429c71 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -25,7 +25,9 @@ EXTRA_DIST = \ libvirtd.sasl \ libvirtd.sysconf \ libvirtd.aug \ - libvirtd.logrotate.in \ + libvirtd.qemu.logrotate.in \ + libvirtd.lxc.logrotate.in \ + libvirtd.uml.logrotate.in \ test_libvirtd.aug \ $(AVAHI_SOURCES) \ $(DAEMON_SOURCES) @@ -177,20 +179,37 @@ remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@
-BUILT_SOURCES += libvirtd.logrotate +LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \ + libvirtd.uml.logrotate
-libvirtd.logrotate: libvirtd.logrotate.in +BUILT_SOURCES += $(LOGROTATE_CONFS) + +libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in + sed \ + -e s!\@localstatedir\@!@localstatedir@!g \ + < $< > $@-t + mv $@-t $@ + +libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in + sed \ + -e s!\@localstatedir\@!@localstatedir@!g \ + < $< > $@-t + mv $@-t $@ + +libvirtd.uml.logrotate: libvirtd.uml.logrotate.in sed \ -e s!\@localstatedir\@!@localstatedir@!g \ < $< > $@-t mv $@-t $@
-install-logrotate: libvirtd.logrotate +install-logrotate: $(LOGROTATE_CONFS) mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/ mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/ - $(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd + $(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu + $(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc + $(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
if LIBVIRT_INIT_SCRIPT_RED_HAT install-init: libvirtd.init diff --git a/daemon/libvirtd.logrotate.in b/daemon/libvirtd.logrotate.in deleted file mode 100644 index 0c51fd3..0000000 --- a/daemon/libvirtd.logrotate.in +++ /dev/null @@ -1,9 +0,0 @@ -@localstatedir@/log/libvirt/qemu/*.log @localstatedir@/log/libvirt/uml/*.log @localstatedir@/log/libvirt/lxc/*.log { - weekly - missingok - rotate 4 - compress - delaycompress - copytruncate - minsize 100k -} diff --git a/daemon/libvirtd.lxc.logrotate.in b/daemon/libvirtd.lxc.logrotate.in new file mode 100644 index 0000000..4e7d314 --- /dev/null +++ b/daemon/libvirtd.lxc.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/lxc/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/daemon/libvirtd.qemu.logrotate.in b/daemon/libvirtd.qemu.logrotate.in new file mode 100644 index 0000000..15cf019 --- /dev/null +++ b/daemon/libvirtd.qemu.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/qemu/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/daemon/libvirtd.uml.logrotate.in b/daemon/libvirtd.uml.logrotate.in new file mode 100644 index 0000000..135a37d --- /dev/null +++ b/daemon/libvirtd.uml.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/uml/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/libvirt.spec.in b/libvirt.spec.in index b1c1c99..17102d9 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -668,16 +668,20 @@ fi %{_sysconfdir}/rc.d/init.d/libvirtd %config(noreplace) %{_sysconfdir}/sysconfig/libvirtd %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf -%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
%if %{with_qemu} %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu %endif %if %{with_lxc} %config(noreplace) %{_sysconfdir}/libvirt/lxc.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc +%endif +%if %{with_uml} +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml %endif
%dir %{_datadir}/libvirt/

On Thu, Mar 11, 2010 at 02:33:48PM +0800, Osier Yang wrote:
hi will it be better provide some configuration in libvirtd.conf or ENV viriable to control the log level of each hypervisor log seperately?
such as I want to libvirt will just log errors for lxc, but any messages for qemu, warning, and error message for uml.
Those logs are usually emitted by the child process so not controllable by libvirt. You can control logs emitted by libvirt from the configuration file (what, what level, and where to output them), see http://libvirt.org/logging.html Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

hmmm, obviously I made a mistake. thanks. osier Daniel Veillard wrote:
On Thu, Mar 11, 2010 at 02:33:48PM +0800, Osier Yang wrote:
hi will it be better provide some configuration in libvirtd.conf or ENV viriable to control the log level of each hypervisor log seperately?
such as I want to libvirt will just log errors for lxc, but any messages for qemu, warning, and error message for uml.
Those logs are usually emitted by the child process so not controllable by libvirt. You can control logs emitted by libvirt from the configuration file (what, what level, and where to output them), see
http://libvirt.org/logging.html
Daniel

On 03/11/2010 01:33 AM, Osier Yang wrote:
hi will it be better provide some configuration in libvirtd.conf or ENV viriable to control the log level of each hypervisor log seperately?
such as I want to libvirt will just log errors for lxc, but any messages for qemu, warning, and error message for uml.
Regards osier
Daniel Veillard wrote:
Original bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=547514
maybe this could be done in slightly different way, possibly more generic, but I think doing a simple split is good enough for now.
Change logrotate to be per-hypervisor logs
Having a single logrotate configuration file for all hypervisors did not work as logrotate would get confused if an hypervisor not supported on that platform was still listed. Simplest is to split the logrotate as separate per hypervisor files and change the spec file to only install the ones compiled in. * daemon/libvirtd.lxc.logrotate.in daemon/libvirtd.qemu.logrotate.in daemon/libvirtd.uml.logrotate.in: copy and split the original daemon/libvirtd.logrotate.in file * daemon/Makefile.am: update to support the different files * libvirt.spec.in: only install the relevant logrotate configs
diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 958a4f6..d429c71 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -25,7 +25,9 @@ EXTRA_DIST = \ libvirtd.sasl \ libvirtd.sysconf \ libvirtd.aug \ - libvirtd.logrotate.in \ + libvirtd.qemu.logrotate.in \ + libvirtd.lxc.logrotate.in \ + libvirtd.uml.logrotate.in \ test_libvirtd.aug \ $(AVAHI_SOURCES) \ $(DAEMON_SOURCES) @@ -177,20 +179,37 @@ remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL) perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@
-BUILT_SOURCES += libvirtd.logrotate +LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \ + libvirtd.uml.logrotate
-libvirtd.logrotate: libvirtd.logrotate.in +BUILT_SOURCES += $(LOGROTATE_CONFS) + +libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in + sed \ + -e s!\@localstatedir\@!@localstatedir@!g \ + < $< > $@-t + mv $@-t $@ + +libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in + sed \ + -e s!\@localstatedir\@!@localstatedir@!g \ + < $< > $@-t + mv $@-t $@ + +libvirtd.uml.logrotate: libvirtd.uml.logrotate.in sed \ -e s!\@localstatedir\@!@localstatedir@!g \ < $< > $@-t mv $@-t $@
-install-logrotate: libvirtd.logrotate +install-logrotate: $(LOGROTATE_CONFS) mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/ mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/ - $(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd + $(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu + $(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc + $(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
if LIBVIRT_INIT_SCRIPT_RED_HAT install-init: libvirtd.init diff --git a/daemon/libvirtd.logrotate.in b/daemon/libvirtd.logrotate.in deleted file mode 100644 index 0c51fd3..0000000 --- a/daemon/libvirtd.logrotate.in +++ /dev/null @@ -1,9 +0,0 @@ -@localstatedir@/log/libvirt/qemu/*.log @localstatedir@/log/libvirt/uml/*.log @localstatedir@/log/libvirt/lxc/*.log { - weekly - missingok - rotate 4 - compress - delaycompress - copytruncate - minsize 100k -} diff --git a/daemon/libvirtd.lxc.logrotate.in b/daemon/libvirtd.lxc.logrotate.in new file mode 100644 index 0000000..4e7d314 --- /dev/null +++ b/daemon/libvirtd.lxc.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/lxc/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/daemon/libvirtd.qemu.logrotate.in b/daemon/libvirtd.qemu.logrotate.in new file mode 100644 index 0000000..15cf019 --- /dev/null +++ b/daemon/libvirtd.qemu.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/qemu/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/daemon/libvirtd.uml.logrotate.in b/daemon/libvirtd.uml.logrotate.in new file mode 100644 index 0000000..135a37d --- /dev/null +++ b/daemon/libvirtd.uml.logrotate.in @@ -0,0 +1,9 @@ +@localstatedir@/log/libvirt/uml/*.log { + weekly + missingok + rotate 4 + compress + delaycompress + copytruncate + minsize 100k +} diff --git a/libvirt.spec.in b/libvirt.spec.in index b1c1c99..17102d9 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -668,16 +668,20 @@ fi %{_sysconfdir}/rc.d/init.d/libvirtd %config(noreplace) %{_sysconfdir}/sysconfig/libvirtd %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf -%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
%if %{with_qemu} %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu %endif %if %{with_lxc} %config(noreplace) %{_sysconfdir}/libvirt/lxc.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc +%endif +%if %{with_uml} +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml %endif
%dir %{_datadir}/libvirt/
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
ACK Dave

On Thu, Mar 04, 2010 at 03:36:26PM +0100, Daniel Veillard wrote:
Original bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=547514
maybe this could be done in slightly different way, possibly more generic, but I think doing a simple split is good enough for now.
Change logrotate to be per-hypervisor logs
Having a single logrotate configuration file for all hypervisors did not work as logrotate would get confused if an hypervisor not supported on that platform was still listed. Simplest is to split the logrotate as separate per hypervisor files and change the spec file to only install the ones compiled in. * daemon/libvirtd.lxc.logrotate.in daemon/libvirtd.qemu.logrotate.in daemon/libvirtd.uml.logrotate.in: copy and split the original daemon/libvirtd.logrotate.in file * daemon/Makefile.am: update to support the different files * libvirt.spec.in: only install the relevant logrotate configs
Actually that last change was not sufficient, for rpms where qemu lxc or uml are not compiled in we also must remove the associated logrotate conf files from the installed tree to avoid rpm build failures Since it's an rpm build breaker I pushed that trivial fix, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (4)
-
Daniel Veillard
-
Dave Allan
-
Eric Blake
-
Osier Yang