From patchwork Thu Mar 31 21:22:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38253 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A6AAE27BBEA; Thu, 31 Mar 2022 22:23:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 70C6F27BBE9 for ; Thu, 31 Mar 2022 22:23:19 +0100 (BST) Received: from localhost ([::1]:50720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1na2GE-0004fp-I9 for patchwork@mira.cbaines.net; Thu, 31 Mar 2022 17:23:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1na2Fz-0004fG-7g for guix-patches@gnu.org; Thu, 31 Mar 2022 17:23:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46119) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1na2Fy-00071N-Vc for guix-patches@gnu.org; Thu, 31 Mar 2022 17:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1na2Fy-00020n-SE for guix-patches@gnu.org; Thu, 31 Mar 2022 17:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54659] [PATCH 2/2] services: Add 'log-cleanup' service to '%base-services' for build logs. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 31 Mar 2022 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54659 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54659@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54659-submit@debbugs.gnu.org id=B54659.16487617497668 (code B ref 54659); Thu, 31 Mar 2022 21:23:02 +0000 Received: (at 54659) by debbugs.gnu.org; 31 Mar 2022 21:22:29 +0000 Received: from localhost ([127.0.0.1]:40015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1na2FR-0001zc-2L for submit@debbugs.gnu.org; Thu, 31 Mar 2022 17:22:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1na2FL-0001z7-P5 for 54659@debbugs.gnu.org; Thu, 31 Mar 2022 17:22:24 -0400 Received: from [2001:470:142:3::e] (port=41452 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1na2FG-0006zJ-IZ; Thu, 31 Mar 2022 17:22:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=pILZFN0Z6d8rWyfwohn3pJ3h5aD3YI68E943A5/nC2c=; b=VHqzK1aOQRH9IcNxoEYZ idalTVn2MYcIlomKlkliQrKVgIXlTDFX/Jsyt+Vrj5Y94AaVPxLoXOyD/d4OyQEdH04RK5134GMGD Fsb65wNt4orenvaXJUs4W6eoM1ps3q/GBB10lkjy8wOBLO06TPIk85MSQAi3nkQZjsXhM5IEI+UqM CsajA2gwALglkcJCUEA9hYcJ0Tp7jbQis307MvuZfUJ/EF0UZ3IcC3JW02OARfPYdb1yO+u8cGdLl JJkvcGNcEe8StGzZ4x6Ff1nyQ0fsdWfRWZcFWauNV/oFqrLtGFLlVNZxcO6YwuGt6UgoaUJbkeMSc KeM2UAVUFVk3Dg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:53161 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1na2FG-0002H8-6c; Thu, 31 Mar 2022 17:22:18 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 31 Mar 2022 23:22:08 +0200 Message-Id: <20220331212208.24385-2-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220331212208.24385-1-ludo@gnu.org> References: <20220331212208.24385-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/base.scm (%base-services): Add 'log-cleanup-service-type' instance. * doc/guix.texi (Log Rotation): Add example and mention '%base-services'. --- doc/guix.texi | 13 ++++++++++++- gnu/services/base.scm | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index ad2763ec8a..eaaf829aa2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17645,7 +17645,18 @@ Some log files just need to be deleted periodically once they are old, without any other criterion and without any archival step. This is the case of build logs stored by @command{guix-daemon} under @file{/var/log/guix/drvs} (@pxref{Invoking guix-daemon}). The -@code{log-cleanup} service addresses this use case. +@code{log-cleanup} service addresses this use case. For example, +@code{%base-services} (@pxref{Base Services}) includes the following: + +@lisp +;; Periodically delete build logs more than 4 months old. +(service log-cleanup-service-type + (log-cleanup-configuration + (directory "/var/log/guix/drvs") + (expiry (* 4 30 24 3600)))) +@end lisp + +That ensures build logs do not accumulate endlessly. @defvr {Scheme Variable} log-cleanup-service-type This is the type of the service to delete old logs. Its value must be a diff --git a/gnu/services/base.scm b/gnu/services/base.scm index f278cb76de..ebaba524bc 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2817,6 +2817,12 @@ (define %base-services (service rottlog-service-type) + ;; Periodically delete build logs more than 4 months old. + (service log-cleanup-service-type + (log-cleanup-configuration + (directory "/var/log/guix/drvs") + (expiry (* 4 30 24 3600)))) + ;; The LVM2 rules are needed as soon as LVM2 or the device-mapper is ;; used, so enable them by default. The FUSE and ALSA rules are ;; less critical, but handy.