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

Peter Krempa pkrempa at redhat.com
Wed Jul 3 06:03:30 UTC 2019


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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190703/b3b85e2f/attachment-0001.sig>


More information about the libvir-list mailing list