On Tue, Jul 02, 2019 at 20:24:09 +0200, Jan Zerebecki wrote:
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(a)zerebecki.de>
---
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(-)
I'm not sure that this is the right thing to do. virtlogd has some
internal log rotation mechanisms and also the SIGUSR1 action is reserved
for re-exec updates and not for dealing with modified files
Additionally the internals are supposed to keep all the FD's open during
re-exec so I'm not even sure that this will help.