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

[libvirt] [PATCH 3/6] Add logrotate support for libvirtd.log



As the file may grow quite a bit especially with debug turned on.
* daemon/libvirtd.logrotate.in daemon/Makefile.am libvirt.spec.in:
  add new logrotate file for the daemon log

Signed-off-by: Daniel Veillard <veillard redhat com>
---
 daemon/Makefile.am           |   10 +++++++++-
 daemon/libvirtd.logrotate.in |    9 +++++++++
 libvirt.spec.in              |    1 +
 3 files changed, 19 insertions(+), 1 deletions(-)
 create mode 100644 daemon/libvirtd.logrotate.in

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 86f024f..5182599 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -32,6 +32,7 @@ EXTRA_DIST =						\
 	libvirtd.sasl					\
 	libvirtd.sysconf				\
 	libvirtd.aug                                    \
+	libvirtd.logrotate.in                           \
 	libvirtd.qemu.logrotate.in                      \
 	libvirtd.lxc.logrotate.in                       \
 	libvirtd.uml.logrotate.in                       \
@@ -246,10 +247,16 @@ qemu_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
 	$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@
 
 LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
-                  libvirtd.uml.logrotate
+                  libvirtd.uml.logrotate libvirtd.logrotate
 
 BUILT_SOURCES += $(LOGROTATE_CONFS)
 
+libvirtd.logrotate: libvirtd.logrotate.in
+	sed							\
+	    -e 's![ ]localstatedir[@]!$(localstatedir)!g'	\
+	    < $< > $ -t
+	mv $ -t $@
+
 libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
 	sed							\
 	    -e 's![ ]localstatedir[@]!$(localstatedir)!g'	\
@@ -273,6 +280,7 @@ install-logrotate: $(LOGROTATE_CONFS)
 	mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/
 	mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/
 	mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
+	$(INSTALL_DATA) libvirtd.logrotate $(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
diff --git a/daemon/libvirtd.logrotate.in b/daemon/libvirtd.logrotate.in
new file mode 100644
index 0000000..4e02510
--- /dev/null
+++ b/daemon/libvirtd.logrotate.in
@@ -0,0 +1,9 @@
+ localstatedir@/log/libvirt/libvirtd.log {
+        weekly
+        missingok
+        rotate 4
+        compress
+        delaycompress
+        copytruncate
+        minsize 100k
+}
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b5c9fd9..45a8fe0 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -865,6 +865,7 @@ fi
 %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
 %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
 
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd
 %if %{with_qemu}
 %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu

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