From nobody Fri Mar 29 07:49:07 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562778875; cv=none; d=zoho.com; s=zohoarc; b=oqUeIlPrZl6hWSn6WPmffWRy+ZNnFPbaw6eYMR7a7W4Z4VrDtBAAVMHcyNLXOLdxGpLEHeZE8+7bDRLks2pHrefk2Q+ZxDAnREirTzeElAxUOP54/kFb4GfGLglBdjziu+fan/DgGnYDbv8uSAQyEk+Bx15+Zzh0pSpX6cKcryo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562778875; h=Content-Type:Content-Transfer-Encoding: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=OkVeoihDUKoAT+bOH9uz6R70+zJrEFoRHRPWn7PqfH8=; b=bSRtnFE7ap+/5vY3JHWcKPoTDMv8nEHgGhlfeuxZYTWmxcXCdo2e1+gHdwKez81qJVT4jfo8YiZNgy59VhVXY1ehoxS4CRfVmrtiibRTaeUoZiDqEYdln2X/VH/xwOIJw8+45agEExH9WpalJnRE1l+wNKvWrX4sLsezXrZ2vII= 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; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562778875782526.2627000383488; Wed, 10 Jul 2019 10:14:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69B5630BD1CE; Wed, 10 Jul 2019 17:14:33 +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 E73B060600; Wed, 10 Jul 2019 17:14:32 +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 7BCC341F53; Wed, 10 Jul 2019 17:14:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6AHETaP002251 for ; Wed, 10 Jul 2019 13:14:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id B0CA560606; Wed, 10 Jul 2019 17:14:29 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD45860600; Wed, 10 Jul 2019 17:14:28 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 10 Jul 2019 18:14:25 +0100 Message-Id: <20190710171425.25262-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] logging: ensure virtlogd rollover takes priority over logrotate 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-Type: text/plain; charset="utf-8" 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 10 Jul 2019 17:14:34 +0000 (UTC) The virtlogd config is set to rollover logs every 2 MB. Normally a logrotate config file is also installed to handle cases where virtlogd is disabled. This is set to rollover weekly with no size constraint. As a result logrotate can interfere with virtlogd's, rolling over files that virtlogd has already taken care of. This changes logrotate configs to rollover based on a max size constraint of 2 MB + 1 byte. When virtlogd is running the log files will never get this large, making logrotate a no-op. If the user changes the size in virtlogd's config to something larger, they are responsible for also changing the logrotate config suitably. The LXC driver doesn't use virtlogd, but its logrotate config is altered to match the QEMU driver logrotate, just for the sake of consistency. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Jim Fehlig --- src/logging/virtlogd.conf | 6 ++++++ src/remote/libvirtd.libxl.logrotate.in | 2 +- src/remote/libvirtd.lxc.logrotate.in | 2 +- src/remote/libvirtd.qemu.logrotate.in | 10 +++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/logging/virtlogd.conf b/src/logging/virtlogd.conf index 72da7f0705..bc41edbc6b 100644 --- a/src/logging/virtlogd.conf +++ b/src/logging/virtlogd.conf @@ -90,6 +90,12 @@ #admin_max_clients =3D 5 =20 # Maximum file size before rolling over. Defaults to 2 MB +# +# Beware that a logrotate config file might be installed too, +# to handle cases where virtlogd is disabled. To ensure that +# the logrotate config is a no-op when virtlogd is running, +# make sure that max_size here is smaller than size listed +# in the logrotate config. #max_size =3D 2097152 =20 # Maximum number of backup files to keep. Defaults to 3, diff --git a/src/remote/libvirtd.libxl.logrotate.in b/src/remote/libvirtd.l= ibxl.logrotate.in index cb7f07d846..1461c1efa1 100644 --- a/src/remote/libvirtd.libxl.logrotate.in +++ b/src/remote/libvirtd.libxl.logrotate.in @@ -1,5 +1,5 @@ @localstatedir@/log/libvirt/libxl/*.log { - weekly + size 2097153 missingok rotate 4 compress diff --git a/src/remote/libvirtd.lxc.logrotate.in b/src/remote/libvirtd.lxc= .logrotate.in index 2bb9dfba12..b88dabb58e 100644 --- a/src/remote/libvirtd.lxc.logrotate.in +++ b/src/remote/libvirtd.lxc.logrotate.in @@ -1,5 +1,5 @@ @localstatedir@/log/libvirt/lxc/*.log { - weekly + size 2097153 missingok rotate 4 compress diff --git a/src/remote/libvirtd.qemu.logrotate.in b/src/remote/libvirtd.qe= mu.logrotate.in index cdb399ef23..78f2ca875e 100644 --- a/src/remote/libvirtd.qemu.logrotate.in +++ b/src/remote/libvirtd.qemu.logrotate.in @@ -1,5 +1,13 @@ @localstatedir@/log/libvirt/qemu/*.log { - weekly + # The QEMU driver is configured to use virtlogd by + # default, which will perform log rollover. + # This logrotate config is still installed for cases + # where the user has switched off virtlogd. + # + # If virtlogd is active, ensure that size here is + # larger than 'max_size' in the virtlogd config + # so that logrotate becomes a no-op + size 2097153 missingok rotate 4 compress --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list