[PATCH] Do not keep empty log files for deleted domains

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

 



With logrotates copytruncate when e.g. domain1 doesn't exist anymore
/var/log/libvirt/qemu/domain1.log will still exist after rotation even
though it will never be written to. When new domain names keep getting
used this leads to a lot of empty logfiles. This may lead to slowdown or
lack of free disk space / inodes.

Fix this by replacing copytruncate with the apropriate postrotate
command to reopen log files. Thus after the apropriate time log files
for deleted domains will be gone. This also has the advantage that the
chance for loss of a few lines during copytruncate is gone.

Signed-off-by: Jan Zerebecki <jan.suse@xxxxxxxxxxxx>
---
 src/remote/libvirtd.libxl.logrotate.in | 4 +++-
 src/remote/libvirtd.logrotate.in       | 4 +++-
 src/remote/libvirtd.lxc.logrotate.in   | 4 +++-
 src/remote/libvirtd.qemu.logrotate.in  | 4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/remote/libvirtd.libxl.logrotate.in b/src/remote/libvirtd.libxl.logrotate.in
index cb7f07d846..d4f25f8cab 100644
--- a/src/remote/libvirtd.libxl.logrotate.in
+++ b/src/remote/libvirtd.libxl.logrotate.in
@@ -4,5 +4,7 @@
         rotate 4
         compress
         delaycompress
-        copytruncate
+        postrotate
+                /usr/bin/killall -USR1 virtlogd
+        endscript
 }
diff --git a/src/remote/libvirtd.logrotate.in b/src/remote/libvirtd.logrotate.in
index 4e02510c8b..73dab7579f 100644
--- a/src/remote/libvirtd.logrotate.in
+++ b/src/remote/libvirtd.logrotate.in
@@ -4,6 +4,8 @@
         rotate 4
         compress
         delaycompress
-        copytruncate
         minsize 100k
+        postrotate
+                /usr/bin/killall -USR1 virtlogd
+        endscript
 }
diff --git a/src/remote/libvirtd.lxc.logrotate.in b/src/remote/libvirtd.lxc.logrotate.in
index 2bb9dfba12..eed47bb55f 100644
--- a/src/remote/libvirtd.lxc.logrotate.in
+++ b/src/remote/libvirtd.lxc.logrotate.in
@@ -4,5 +4,7 @@
         rotate 4
         compress
         delaycompress
-        copytruncate
+        postrotate
+                /usr/bin/killall -USR1 virtlogd
+        endscript
 }
diff --git a/src/remote/libvirtd.qemu.logrotate.in b/src/remote/libvirtd.qemu.logrotate.in
index cdb399ef23..95407cec1a 100644
--- a/src/remote/libvirtd.qemu.logrotate.in
+++ b/src/remote/libvirtd.qemu.logrotate.in
@@ -4,5 +4,7 @@
         rotate 4
         compress
         delaycompress
-        copytruncate
+        postrotate
+                /usr/bin/killall -USR1 virtlogd
+        endscript
 }
-- 
2.20.1

--
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]

  Powered by Linux