From nobody Mon Feb 9 07:26:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562092072; cv=none; d=zoho.com; s=zohoarc; b=SnkEBZZZOQbZbBWy0kfwO2WhPc5aUHdvOMUp7vypZYiAdEkvxq5c8+YKodWYZKpDjzJwYlinqyBKKc/FqefJP1AUNSxdDFX7x+Ze4wexxYhH/hs62fb7zvj4njgyz5Sod2XKTCaI3wB7IyT7Iv+yV++mwYSQgY1e3KXO2c/WW3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562092072; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=4WR4TT4NykgFmL0m0a2VNrGw3XdyzX+ISKgGI95hbfw=; b=CLxI+5OeRknOd03ifE63egoW80V+CSGKc7eN7r9dOQCx5UJACqk7VWxrjrSR6P9rBG4URqGiIFvW3AbtE7w7s3of/12RVdYCPaLf8cKkBb9/AVgvA+8WR0hO7eAa2shZxPWdXlg3gFkMytK2YVDancWZ7kPkPB4RIPLqfxcX6wg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562092072139299.18471121523135; Tue, 2 Jul 2019 11:27:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5998F31628F8; Tue, 2 Jul 2019 18:26:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A18EF5E1DD; Tue, 2 Jul 2019 18:26:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 59DF94EBC9; Tue, 2 Jul 2019 18:25:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x62IPeZD020895 for ; Tue, 2 Jul 2019 14:25:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC11F1992E; Tue, 2 Jul 2019 18:25:40 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5BF319733 for ; Tue, 2 Jul 2019 18:25:37 +0000 (UTC) Received: from smtp01.zerebecki.de (sammiittai.zerebecki.de [176.9.136.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4D8F981D3 for ; Tue, 2 Jul 2019 18:25:05 +0000 (UTC) Received: from ipservice-092-209-022-036.092.209.pools.vodafone-ip.de ([92.209.22.36] helo=localhost.localdomain) by smtp01.zerebecki.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hiNSd-0005XU-6o; Tue, 02 Jul 2019 20:24:59 +0200 From: Jan Zerebecki To: libvir-list@redhat.com Date: Tue, 2 Jul 2019 20:24:09 +0200 Message-Id: <20190702182409.16576-1-jan.suse@zerebecki.de> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, ACL 242 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 02 Jul 2019 18:25:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 02 Jul 2019 18:25:26 +0000 (UTC) for IP:'176.9.136.73' DOMAIN:'sammiittai.zerebecki.de' HELO:'smtp01.zerebecki.de' FROM:'jan.suse@zerebecki.de' RCPT:'' X-RedHat-Spam-Score: 0.001 (SPF_HELO_NONE) 176.9.136.73 sammiittai.zerebecki.de 176.9.136.73 sammiittai.zerebecki.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Jan Zerebecki Subject: [libvirt] [PATCH] Do not keep empty log files for deleted domains X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 02 Jul 2019 18:27:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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 --- 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.l= ibxl.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.logrota= te.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.qe= mu.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 } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list