From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id yMjbAXwxTmZ+KAAAA41jLg (envelope-from ) for ; Wed, 22 May 2024 19:55:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id IODlN3sxTmZnOgEA62LTzQ (envelope-from ) for ; Wed, 22 May 2024 19:55:08 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=Bagd9YGn; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716400507; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=MBM6lykvU4zdy6/wqG1om+OGKjkLbUfbfUjdzT81GcQ=; b=BzbZ8fId1QGMHUxPFxs4VuubHuizJEHdOcaupUDsj1UyxUWuQVzO/2j6DTYxjOisqOudgv i4mQujuLCDbnOSOBJ971Y+oaWUwpGiOteAktluUH2mvW6+pHge836eBRERRLedBEKkh6Ci RdDPXl011ux8PsNRGV0sj0Y3rCDdbML8X3Gx3jS38fsCmhEe1Vp/JCHr+ib1nR9bC7hR87 xPhIGOoFqJkCU2gy3s7djKX3oDdLu3cnYXpHyzqgCJuxtZATIyFDuPdl7SMsw3rGrTJe5W bUSOvFRtna/yiIjGKqTFMYX+nqK3E3cbDzpcwjJU+n5HnIkW1NkJW9TZLOESYg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716400507; a=rsa-sha256; cv=none; b=Bw1XZ/oSlaZCU80fqgCSEtIG46kzAb42HqrdwmJBD3L/tLs3RbGDQ0PdyJuLQrfIA9WaGp S+e9wvIu5oT3LLET9r81HnpRRoBcPujUVB1+VSfU7uwgf7eA+pWLo96atXBXzdwenCIsYz RecNRkhBjq8wrWFrm+rrHP6d5yuYPrOCVn2pP41OJKarkYmarnawJwMzNWL3dWtAay6Bvq WRJI3svu/AUfGw9xeyDcvOpdLYycq8ibpuylkidbis/BzJgHTlmvp6502IMs9rpnV+LtVy Bs/qpmGim3G0lz76I5Ffe10VSila7UOJgfyE6MQlWqI4oTXnvNRR9yvyVM13dA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=Bagd9YGn; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3B732382E0 for ; Wed, 22 May 2024 19:55:07 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9qAb-0004D9-Fi; Wed, 22 May 2024 13:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9qAY-0004CJ-Nt for guix-devel@gnu.org; Wed, 22 May 2024 13:54:31 -0400 Received: from sail-ipv4.us-core.com ([208.82.101.137]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1s9qAW-0006XV-D4; Wed, 22 May 2024 13:54:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=IVEPmumWwTzeLzb URyOmNjuZ9z5H7amNTaObHwwsMiQ=; h=date:references:in-reply-to:subject: cc:to:from; d=lease-up.com; b=Bagd9YGnCMz/WJ/BG/DyG7u1Off5X1yuuzktKsaa leUhad5Ry0lDSVoUOOVOT4dYhVtfTCX7hJzYntFP1h1wvuk5kK9jb4FS9zuEiGb2i0JnYu /O0ufbqQHfkFd38EarEBK8qHHYRTzAhDPr5Wm30WSWjNy/X49NAy1Tqt4+qLc= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 1c997e4b (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Wed, 22 May 2024 17:54:24 +0000 (UTC) To: Ludovic =?utf-8?Q?Court=C3=A8s?= , guix-devel@gnu.org Cc: Subject: Re: Shepherd log rotation service In-Reply-To: <87ed9y4ygj.fsf@inria.fr> References: <87ed9y4ygj.fsf@inria.fr> Date: Wed, 22 May 2024 10:54:23 -0700 Message-ID: <877cflu3zk.fsf@lease-up.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=208.82.101.137; envelope-from=felix.lechner@lease-up.com; helo=sail-ipv4.us-core.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Felix Lechner From: Felix Lechner via "Development of GNU Guix and the GNU System distribution." Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.86 X-Spam-Score: -3.86 X-Migadu-Queue-Id: 3B732382E0 X-Migadu-Scanner: mx11.migadu.com X-TUID: SrhdatQL9bG8 Hi Ludo', > I=E2=80=99ve just pushed a simple log rotation service for Shepherd: Wow, that's another cool addition! I am currently testing a patch that removes the rottlog service extension from all services that use #:log-file. Not all do. I should will make an immediate dent in my 200 MB log file for Fcgiwrap, but not for an Rspamd file of similar size. Also, my Nginx log file with 1.3 GB will remain unaffected. Most significantly, it simplifies a lot of code. To make the addition of my new log-rotation-service-type compatible with folks who use the rottlog service extension outside the main repo, I also hope to make the service extension a no-op when the underlying Shepherd service uses the #:log-file facility. Meanwhile, I have a few questions: Should log-rotation-service be called make-log-rotation-service? Should the key #:rotation-size-threshold be renamed to size-threshold? I'm not asking to change the name of the variable holding the default value. The current key looks longer than needed in this code: (define (log-rotation-shepherd-service config) (match-record config (compression event expiry size-threshold) #~((log-rotation-service #$event #:compression #$compression #:expiry #$expiry #:rotation-size-threshold #$size-threshold)))) Also, is it good practice, in log-rotation-service, to use an optional argument (for event) together with keyword arguments? Why not use keyword arguments all around? Finally, are there truly no (Shepherd) service requirements? Or will any Shepherd service that uses #:log-file automatically make sure that the file-system is available? Thank you for this cool new feature! Kind regards Felix On Sat, May 18 2024, Ludovic Court=C3=A8s wrote: > Hello Guix! > > > https://git.savannah.gnu.org/cgit/shepherd.git/commit/?h=3Ddevel&id=3D0= 484726801c2b5c1b7deecb9a96054c2c510ac71 > > It rotates log files roughly the same way we=E2=80=99ve been doing since = the > 70=E2=80=99s, but there=E2=80=99s a couple of advantages compared to what= we=E2=80=99re > currently doing in Guix System: > > =E2=80=A2 No need to repeat the name of log files since shepherd alread= y knows > them via #:log-file (that=E2=80=99s another reason to avoid > non-shepherd-managed log files). > > =E2=80=A2 Rotation is race-free: it=E2=80=99s impossible to lose a line= of log while > the file is being rotated. This is guaranteed by the =E2=80=9Clogger= =E2=80=9D, > which offers a method to atomically close its log file, rename it, > and open a new empty log file. > > =E2=80=A2 The log rotation service is a timer so one can inspect it wit= h =E2=80=98herd > status log-rotation=E2=80=99, trigger it with =E2=80=98herd trigger l= og-rotation=E2=80=99, > and so on. > > At this point the log file of shepherd itself, for instance > /var/log/messages, is not handled; this will have to be fixed. > > There aren=E2=80=99t many options to specify how to rotate logs (very few > compared to rottlog!), but I figured we=E2=80=99d rather have something s= imple > that works well and without surprises; we can always add knobs later if > necessary. > > Feedback welcome! > > Ludo=E2=80=99.