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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

ACK

Dave

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]