From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 11 Jul 2017 06:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 27650@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149975623426907 (code B ref -1); Tue, 11 Jul 2017 06:58:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jul 2017 06:57:14 +0000 Received: from localhost ([127.0.0.1]:33288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUp6g-0006zv-EE for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUp6e-0006zi-Ci for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUp6X-0002vf-SV for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53675) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUp6X-0002vb-PQ for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUp6V-0003if-VF for guix-patches@gnu.org; Tue, 11 Jul 2017 02:57:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUp6S-0002v4-RA for guix-patches@gnu.org; Tue, 11 Jul 2017 02:57:04 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:47941 helo=mira.cbaines.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUp6S-0002qc-IZ for guix-patches@gnu.org; Tue, 11 Jul 2017 02:57:00 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id D1BD313D1D5; Tue, 11 Jul 2017 07:56:34 +0100 (BST) Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 7A4AB13D1D3 for ; Tue, 11 Jul 2017 07:56:34 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 833a2c7e for ; Tue, 11 Jul 2017 06:56:34 +0000 (UTC) From: Christopher Baines Date: Tue, 11 Jul 2017 07:56:34 +0100 Message-Id: <20170711065634.9717-1-mail@cbaines.net> X-Mailer: git-send-email 2.13.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) * gnu/services/admin.scm (, ): New record types. (tailon-configuration-files-string, tailon-shepherd-service): New procedures. (%tailon-accounts, tailon-service-type: New variables. * doc/guix.text (Monitoring Services: Document the Tailon service. --- doc/guix.texi | 88 +++++++++++++++++++++++++++++ gnu/services/admin.scm | 150 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 237 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 729ec081b..164dccba1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -218,6 +218,7 @@ Services * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -8901,6 +8902,7 @@ declaration. * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -13489,6 +13491,92 @@ string, you could instantiate a prosody service like this: (prosody.cfg.lua ""))) @end example +@node Monitoring Services +@subsubsection Monitoring Services + +@subsubheading Tailon Service + +Tailon is a web application for viewing and searching log files. + +The following example will configure the service with default values. +By default, Tailon can be accessed on port 8080 (http://localhost:8080). + +@example +(service tailon-service-type) +@end example + +The following example customises more of the Tailon configuration, +adding ``sed'' to the list of allowed commands. + +@example +(service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (allowed-commands '("tail" "grep" "awk" "sed")))))) +@end example + + +@deftp {Data Type} tailon-configuration +Data type representing the configuration of tailon. +This type has the following parameters: + +@table @asis +@item @code{config-file} (default: @code{(tailon-configuration-file)}) +The configuration file to use for Tailon. This can be set to a +@dfn{tailon-configuration-file} record value, or any gexp +(@pxref{G-Expressions}). + +For example, to instead use a local file, the @code{local-file} function +can be used: + +@example +(service tailon-service-type + (tailon-configuration + (config-file (local-file "./my-tailon.conf")))) +@end example + +@item @code{package} (default: @code{tailon}) +The tailon package to use. + +@end table +@end deftp + +@deftp {Data Type} tailon-configuration-file +Data type representing the configuration options for Tailon. +This type has the following parameters: + +@table @asis +@item @code{paths} (default: @code{(list "/var/log")}) +List of paths to display. Can include strings for a single path, or a +list, where the first item is the name of a subsection, and the +remaining items are in that subsection. + +@item @code{bind} (default: @code{"localhost:8080"}) +Address and port to which Tailon should bind on. + +@item @code{relative-root-path} (default: @code{#f}) +Prefix to use for all paths, set to @code{#f} to disable using a prefix. + +@item @code{allow-transfers?} (default: @code{#t}) +Allow downloading the log files in the web interface. + +@item @code{follow-names?} (default: @code{#t}) +Allow tailing of not-yet existent files. + +@item @code{tail-lines} (default: @code{200}) +Number of lines to read initially from each file. + +@item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")}) +Commands to allow running. By default, @code{sed} is disabled. + +@item @code{debug?} (default: @code{#f}) +Set @code{debug?} to @code{#t} to show debug messages. + +@end table +@end deftp + + @node Kerberos Services @subsubsection Kerberos Services @cindex Kerberos diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index b9e3fa70a..eb1f70ec6 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -20,14 +20,19 @@ (define-module (gnu services admin) #:use-module (gnu packages admin) #:use-module (gnu packages base) + #:use-module (gnu packages logging) #:use-module (gnu services) #:use-module (gnu services mcron) #:use-module (gnu services shepherd) + #:use-module (gnu services web) + #:use-module (gnu system shadow) #:use-module (guix gexp) + #:use-module (guix store) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 vlist) + #:use-module (ice-9 match) #:export (%default-rotations %rotated-files @@ -41,7 +46,27 @@ rottlog-configuration rottlog-configuration? rottlog-service - rottlog-service-type)) + rottlog-service-type + + + tailon-configuration-file + tailon-configuration-file? + tailon-configuration-file-paths + tailon-configuration-file-bind + tailon-configuration-file-relative-root-path + tailon-configuration-file-allow-transfers? + tailon-configuration-file-follow-names? + tailon-configuration-file-tail-lines + tailon-configuration-file-allowed-commands + tailon-configuration-file-debug? + + + tailon-configuration + tailon-configuration? + tailon-configuration-config-file + tailon-configuration-package + + tailon-service-type)) ;;; Commentary: ;;; @@ -172,4 +197,127 @@ for ROTATION." rotations))))) (default-value (rottlog-configuration)))) + +;;; +;;; Tailon +;;; + +(define-record-type* + tailon-configuration-file make-tailon-configuration-file + tailon-configuration-file? + (paths tailon-configuration-paths + (default '("/var/log"))) + (bind tailon-configuration-file-bind + (default "localhost:8080")) + (relative-root-path tailon-configuration-file-relative-root-path + (default #f)) + (allow-transfers? tailon-configuration-file-allow-transfers? + (default #t)) + (follow-names? tailon-configuration-file-follow-names? + (default #t)) + (tail-lines tailon-configuration-file-tail-lines + (default 200)) + (allowed-commands tailon-configuration-file-allowed-commands + (default '("tail" "grep" "awk"))) + (debug? tailon-configuration-file-debug? + (default #f))) + +(define (tailon-configuration-files-string paths) + (string-append + "\n" + (string-join + (map + (lambda (x) + (string-append + " - " + (cond + ((string? x) + (simple-format #f "'~A'" x)) + ((list? x) + (string-join + (cons (simple-format #f "'~A':" (car x)) + (map + (lambda (x) (simple-format #f " - '~A'" x)) + (cdr x))) + "\n")) + (else (error x))))) + paths) + "\n"))) + +(define-gexp-compiler (tailon-configuration-file-compiler + (file ) system target) + (match file + (($ paths bind relative-root-path + allow-transfers? follow-names? + tail-lines allowed-commands debug?) + (text-file + "tailon-config.yaml" + (string-concatenate + (filter-map + (match-lambda + ((key . #f) #f) + ((key . value) (string-append key ": " value "\n"))) + + `(("files" . ,(tailon-configuration-files-string paths)) + ("bind" . ,bind) + ("relative-root" . ,relative-root-path) + ("allow-transfers" . ,(if allow-transfers? "true" "false")) + ("follow-names" . ,(if follow-names? "true" "false")) + ("tail-lines" . ,(number->string tail-lines)) + ("commands" . ,(string-append "[" + (string-join allowed-commands ", ") + "]")) + ,@(if debug? '(("debug" . "true")) '())))))))) + +(define-record-type* + tailon-configuration make-tailon-configuration + tailon-configuration? + (config-file tailon-configuration-config-file + (default (tailon-configuration-file))) + (package tailon-configuration-package + (default tailon))) + +(define tailon-shepherd-service + (match-lambda + (($ config-file package) + (list (shepherd-service + (provision '(tailon)) + (documentation "Run the tailon daemon.") + (start #~(make-forkexec-constructor + `(,(string-append #$package "/bin/tailon") + "-c" ,#$config-file) + #:user "tailon" + #:group "tailon")) + (stop #~(make-kill-destructor))))))) + +(define %tailon-accounts + (list (user-group (name "tailon") (system? #t)) + (user-account + (name "tailon") + (group "tailon") + (system? #t) + (comment "tailon") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define tailon-service-type + (service-type + (name 'tailon) + (extensions + (list (service-extension shepherd-root-service-type + tailon-shepherd-service) + (service-extension account-service-type + (const %tailon-accounts)))) + (compose concatenate) + (extend (lambda (parameter paths) + (tailon-configuration + (inherit parameter) + (config-file + (let ((old-config-file (tailon-configuration-config-file parameter))) + (tailon-configuration-file + (inherit old-config-file) + (paths (append (tailon-configuration-paths old-config-file) + paths)))))))) + (default-value (tailon-configuration)))) + ;;; admin.scm ends here -- 2.13.1 From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 12 Jul 2017 12:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.1499861620579 (code B ref 27650); Wed, 12 Jul 2017 12:14:01 +0000 Received: (at 27650) by debbugs.gnu.org; 12 Jul 2017 12:13:40 +0000 Received: from localhost ([127.0.0.1]:34826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVGWS-00009H-07 for submit@debbugs.gnu.org; Wed, 12 Jul 2017 08:13:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39237) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVGWP-00008z-Lw for 27650@debbugs.gnu.org; Wed, 12 Jul 2017 08:13:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVGWG-0001Nb-BH for 27650@debbugs.gnu.org; Wed, 12 Jul 2017 08:13:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVGWG-0001NX-7L; Wed, 12 Jul 2017 08:13:28 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:56194 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dVGWF-0007sD-EA; Wed, 12 Jul 2017 08:13:27 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170711065634.9717-1-mail@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 Messidor an 225 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Wed, 12 Jul 2017 14:13:25 +0200 In-Reply-To: <20170711065634.9717-1-mail@cbaines.net> (Christopher Baines's message of "Tue, 11 Jul 2017 07:56:34 +0100") Message-ID: <87shi1etui.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi Christopher, Christopher Baines skribis: > * gnu/services/admin.scm > (, ): New record types. > (tailon-configuration-files-string, tailon-shepherd-service): New > procedures. > (%tailon-accounts, tailon-service-type: New variables. > * doc/guix.text (Monitoring Services: Document the Tailon service. Neat. Maybe a service we could take advantage of on our build farm machines? s/text/texi/ :-) > +@node Monitoring Services > +@subsubsection Monitoring Services > + > +@subsubheading Tailon Service > + > +Tailon is a web application for viewing and searching log files. Please write @uref{https://=E2=80=A6, Tailon} so readers can read more abou= t it if needed. > +The following example will configure the service with default values. > +By default, Tailon can be accessed on port 8080 (http://localhost:8080). ^ @code > +The following example customises more of the Tailon configuration, > +adding ``sed'' to the list of allowed commands. ^^ @command{sed} > +@deftp {Data Type} tailon-configuration > +Data type representing the configuration of tailon. Tailon (capital). > +@table @asis > +@item @code{paths} (default: @code{(list "/var/log")}) > +List of paths to display. Can include strings for a single path, or a > +list, where the first item is the name of a subsection, and the > +remaining items are in that subsection. Please s/paths/directories/ (in GNU the convention is to use =E2=80=9Cfile = name=E2=80=9D or =E2=80=9Cdirectory name=E2=80=9D, whereas =E2=80=9Cpath=E2=80=9D is rese= rved for search paths.) > + (paths tailon-configuration-paths > + (default '("/var/log"))) > + (bind tailon-configuration-file-bind > + (default "localhost:8080")) > + (relative-root-path tailon-configuration-file-relative-root-path > + (default #f)) Same here. > +(define-gexp-compiler (tailon-configuration-file-compiler > + (file ) system target) That=E2=80=99s a good idea. :-) Otherwise LGTM! Bonus points if you write a system test that checks that at least the Web server shows up on port 8080. Thank you! Ludo=E2=80=99. From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 16 Jul 2017 15:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150022031722434 (code B ref 27650); Sun, 16 Jul 2017 15:52:02 +0000 Received: (at 27650) by debbugs.gnu.org; 16 Jul 2017 15:51:57 +0000 Received: from localhost ([127.0.0.1]:42602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWlps-0005pl-PG for submit@debbugs.gnu.org; Sun, 16 Jul 2017 11:51:57 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:53669 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWlpq-0005pd-LQ for 27650@debbugs.gnu.org; Sun, 16 Jul 2017 11:51:56 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id A899C13D1D4; Sun, 16 Jul 2017 16:51:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 9D69013D1D3; Sun, 16 Jul 2017 16:51:52 +0100 (BST) Date: Sun, 16 Jul 2017 16:51:49 +0100 From: Christopher Baines Message-ID: <20170716165149.48c2fe19@cbaines.net> In-Reply-To: <87shi1etui.fsf@gnu.org> References: <20170711065634.9717-1-mail@cbaines.net> <87shi1etui.fsf@gnu.org> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/FdcrlYGra.BJkJWml5fPDbn"; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Sig_/FdcrlYGra.BJkJWml5fPDbn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 12 Jul 2017 14:13:25 +0200 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Hi Christopher, >=20 > Christopher Baines skribis: >=20 > > * gnu/services/admin.scm > > (, ): New record > > types. (tailon-configuration-files-string, > > tailon-shepherd-service): New procedures. > > (%tailon-accounts, tailon-service-type: New variables. > > * doc/guix.text (Monitoring Services: Document the Tailon service. =20 >=20 > Neat. Maybe a service we could take advantage of on our build farm > machines? Thanks for your review, I'll send an updated patch with the texinfo improvements, and the path/file/directory naming changes. > > +(define-gexp-compiler (tailon-configuration-file-compiler > > + (file ) system > > target) =20 >=20 > That=E2=80=99s a good idea. :-) I'm glad you think so. This pattern should make either using the provided record type, or something else very easy, as there are no special cases in the service code. > Bonus points if you write a system test that checks that at least the > Web server shows up on port 8080. I've had a go at this, I'll send a separate patch. It doesn't pass for me yet, and I'm not sure how to work out what is going on inside the test system, does anyone have any tips for writing and debugging system tests in general? --Sig_/FdcrlYGra.BJkJWml5fPDbn Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAllri5VfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XfnUw//aq2fvToXiP0tPpX6/2g5Ozg/BQlh3qye+39DnuI67+0NNJHLfVE33cb3 7PKhEJ/Q2Orrt4pbRlzzds+6o3E7CP8u44gcI44y15jjOJ4FxTfFYEmOw9WACJzT iMcRLaDy7/o0ng0R+IXz/9LLvNfzlbham/ikJCoETD9MCOiMruS1ivKABKXpGj/f 1lEEyhHQCT1ryKSmw3W6Bl41WYEuQ5KonDT4W9yJUObxbP6Py3lURbEwtkfECJvf BKALyfMaghyPB/az7ZjJZstPysPaDo6zJVYf6M4itGVXrvk9JBl9FD1XQJylo9fz s7spjhBMeNnsBEhDk+TOF6EpVI5/76ixpPJnbUvTI/9vSgsbJfB2LSMxEhNeuhBs Po44tV6nUceJPYNaPS3Gbgf39Q1kDjZDMq+kX6u5xs1f+ERCE4JfdEPz2Mf9TYJ0 Iy6Ffo5CNM4vnRfK5b/N0hSWAzcV7vTvebtMabMVgm2a6xc0ICkgcNvm7DjNPFqK PTZBdh2OtPI8t/baRGEegcye+xfuSiV3bpyL5r8GDOBfntXFEEXw94xw8wLdx4kq Dk1dxPU41/Y618MHLkyerRB2hEy6+zCw6RrivbnsN6e/2PBiSHBK5ILgdBysioyB XPRBsi86Vga+T0M09z4KtIP+cs+fqSD2FVyFVys64ToUhV+VZ10= =n+eA -----END PGP SIGNATURE----- --Sig_/FdcrlYGra.BJkJWml5fPDbn-- From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 16 Jul 2017 15:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150022034922502 (code B ref 27650); Sun, 16 Jul 2017 15:53:01 +0000 Received: (at 27650) by debbugs.gnu.org; 16 Jul 2017 15:52:29 +0000 Received: from localhost ([127.0.0.1]:42606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWlqP-0005qs-Dv for submit@debbugs.gnu.org; Sun, 16 Jul 2017 11:52:29 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:53672 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWlqN-0005qk-Ih for 27650@debbugs.gnu.org; Sun, 16 Jul 2017 11:52:28 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 14D7713D1D4; Sun, 16 Jul 2017 16:52:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 91BA513D1D3 for <27650@debbugs.gnu.org>; Sun, 16 Jul 2017 16:52:26 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id c5c2b7b9 for <27650@debbugs.gnu.org>; Sun, 16 Jul 2017 15:52:26 +0000 (UTC) From: Christopher Baines Date: Sun, 16 Jul 2017 16:52:26 +0100 Message-Id: <20170716155226.13689-1-mail@cbaines.net> X-Mailer: git-send-email 2.13.1 In-Reply-To: <87shi1etui.fsf@gnu.org> References: <87shi1etui.fsf@gnu.org> X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/services/admin.scm (, ): New record types. (tailon-configuration-files-string, tailon-shepherd-service): New procedures. (%tailon-accounts, tailon-service-type: New variables. * doc/guix.texi (Monitoring Services: Document the Tailon service. --- doc/guix.texi | 89 +++++++++++++++++++++++++++++ gnu/services/admin.scm | 151 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 239 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index ecf961772..1226e1721 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -218,6 +218,7 @@ Services * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -8921,6 +8922,7 @@ declaration. * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -13509,6 +13511,93 @@ string, you could instantiate a prosody service like this: (prosody.cfg.lua ""))) @end example +@node Monitoring Services +@subsubsection Monitoring Services + +@subsubheading Tailon Service + +@uref{https://tailon.readthedocs.io/, Tailon} is a web application for +viewing and searching log files. + +The following example will configure the service with default values. +By default, Tailon can be accessed on port 8080 (@code{http://localhost:8080}). + +@example +(service tailon-service-type) +@end example + +The following example customises more of the Tailon configuration, +adding @command{sed} to the list of allowed commands. + +@example +(service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (allowed-commands '("tail" "grep" "awk" "sed")))))) +@end example + + +@deftp {Data Type} tailon-configuration +Data type representing the configuration of Tailon. +This type has the following parameters: + +@table @asis +@item @code{config-file} (default: @code{(tailon-configuration-file)}) +The configuration file to use for Tailon. This can be set to a +@dfn{tailon-configuration-file} record value, or any gexp +(@pxref{G-Expressions}). + +For example, to instead use a local file, the @code{local-file} function +can be used: + +@example +(service tailon-service-type + (tailon-configuration + (config-file (local-file "./my-tailon.conf")))) +@end example + +@item @code{package} (default: @code{tailon}) +The tailon package to use. + +@end table +@end deftp + +@deftp {Data Type} tailon-configuration-file +Data type representing the configuration options for Tailon. +This type has the following parameters: + +@table @asis +@item @code{files} (default: @code{(list "/var/log")}) +List of files to display. The list can include strings for a single +file, or a list, where the first item is the name of a subsection, and +the remaining items are the files in that subsection. + +@item @code{bind} (default: @code{"localhost:8080"}) +Address and port to which Tailon should bind on. + +@item @code{relative-root-path} (default: @code{#f}) +Prefix to use for all paths, set to @code{#f} to disable using a prefix. + +@item @code{allow-transfers?} (default: @code{#t}) +Allow downloading the log files in the web interface. + +@item @code{follow-names?} (default: @code{#t}) +Allow tailing of not-yet existent files. + +@item @code{tail-lines} (default: @code{200}) +Number of lines to read initially from each file. + +@item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")}) +Commands to allow running. By default, @code{sed} is disabled. + +@item @code{debug?} (default: @code{#f}) +Set @code{debug?} to @code{#t} to show debug messages. + +@end table +@end deftp + + @node Kerberos Services @subsubsection Kerberos Services @cindex Kerberos diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index b9e3fa70a..26b5c6edb 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -20,14 +20,19 @@ (define-module (gnu services admin) #:use-module (gnu packages admin) #:use-module (gnu packages base) + #:use-module (gnu packages logging) #:use-module (gnu services) #:use-module (gnu services mcron) #:use-module (gnu services shepherd) + #:use-module (gnu services web) + #:use-module (gnu system shadow) #:use-module (guix gexp) + #:use-module (guix store) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 vlist) + #:use-module (ice-9 match) #:export (%default-rotations %rotated-files @@ -41,7 +46,27 @@ rottlog-configuration rottlog-configuration? rottlog-service - rottlog-service-type)) + rottlog-service-type + + + tailon-configuration-file + tailon-configuration-file? + tailon-configuration-file-files + tailon-configuration-file-bind + tailon-configuration-file-relative-root-directory + tailon-configuration-file-allow-transfers? + tailon-configuration-file-follow-names? + tailon-configuration-file-tail-lines + tailon-configuration-file-allowed-commands + tailon-configuration-file-debug? + + + tailon-configuration + tailon-configuration? + tailon-configuration-config-file + tailon-configuration-package + + tailon-service-type)) ;;; Commentary: ;;; @@ -172,4 +197,128 @@ for ROTATION." rotations))))) (default-value (rottlog-configuration)))) + +;;; +;;; Tailon +;;; + +(define-record-type* + tailon-configuration-file make-tailon-configuration-file + tailon-configuration-file? + (files tailon-configuration-file-files + (default '("/var/log"))) + (bind tailon-configuration-file-bind + (default "localhost:8080")) + (relative-root-directory tailon-configuration-file-relative-root-directory + (default #f)) + (allow-transfers? tailon-configuration-file-allow-transfers? + (default #t)) + (follow-names? tailon-configuration-file-follow-names? + (default #t)) + (tail-lines tailon-configuration-file-tail-lines + (default 200)) + (allowed-commands tailon-configuration-file-allowed-commands + (default '("tail" "grep" "awk"))) + (debug? tailon-configuration-file-debug? + (default #f))) + +(define (tailon-configuration-files-string files) + (string-append + "\n" + (string-join + (map + (lambda (x) + (string-append + " - " + (cond + ((string? x) + (simple-format #f "'~A'" x)) + ((list? x) + (string-join + (cons (simple-format #f "'~A':" (car x)) + (map + (lambda (x) (simple-format #f " - '~A'" x)) + (cdr x))) + "\n")) + (else (error x))))) + files) + "\n"))) + +(define-gexp-compiler (tailon-configuration-file-compiler + (file ) system target) + (match file + (($ files bind relative-root-directory + allow-transfers? follow-names? + tail-lines allowed-commands debug?) + (text-file + "tailon-config.yaml" + (string-concatenate + (filter-map + (match-lambda + ((key . #f) #f) + ((key . value) (string-append key ": " value "\n"))) + + `(("files" . ,(tailon-configuration-files-string files)) + ("bind" . ,bind) + ("relative-root" . ,relative-root-directory) + ("allow-transfers" . ,(if allow-transfers? "true" "false")) + ("follow-names" . ,(if follow-names? "true" "false")) + ("tail-lines" . ,(number->string tail-lines)) + ("commands" . ,(string-append "[" + (string-join allowed-commands ", ") + "]")) + ,@(if debug? '(("debug" . "true")) '())))))))) + +(define-record-type* + tailon-configuration make-tailon-configuration + tailon-configuration? + (config-file tailon-configuration-config-file + (default (tailon-configuration-file))) + (package tailon-configuration-package + (default tailon))) + +(define tailon-shepherd-service + (match-lambda + (($ config-file package) + (list (shepherd-service + (provision '(tailon)) + (documentation "Run the tailon daemon.") + (start #~(make-forkexec-constructor + `(,(string-append #$package "/bin/tailon") + "-c" ,#$config-file) + #:user "tailon" + #:group "tailon")) + (stop #~(make-kill-destructor))))))) + +(define %tailon-accounts + (list (user-group (name "tailon") (system? #t)) + (user-account + (name "tailon") + (group "tailon") + (system? #t) + (comment "tailon") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define tailon-service-type + (service-type + (name 'tailon) + (extensions + (list (service-extension shepherd-root-service-type + tailon-shepherd-service) + (service-extension account-service-type + (const %tailon-accounts)))) + (compose concatenate) + (extend (lambda (parameter files) + (tailon-configuration + (inherit parameter) + (config-file + (let ((old-config-file + (tailon-configuration-config-file parameter))) + (tailon-configuration-file + (inherit old-config-file) + (files (append (tailon-configuration-file-files old-config-file) + files)))))))) + (default-value (tailon-configuration)))) + ;;; admin.scm ends here -- 2.13.1 From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] tests: Add 'tailon-service-type' test. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 16 Jul 2017 15:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150022070322985 (code B ref 27650); Sun, 16 Jul 2017 15:59:01 +0000 Received: (at 27650) by debbugs.gnu.org; 16 Jul 2017 15:58:23 +0000 Received: from localhost ([127.0.0.1]:42610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWlw7-0005yf-9i for submit@debbugs.gnu.org; Sun, 16 Jul 2017 11:58:23 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:53676 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWlw1-0005yS-C2 for 27650@debbugs.gnu.org; Sun, 16 Jul 2017 11:58:21 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 8027413D1D4; Sun, 16 Jul 2017 16:58:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 5E4A713D1D3 for <27650@debbugs.gnu.org>; Sun, 16 Jul 2017 16:58:15 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 9750b749 for <27650@debbugs.gnu.org>; Sun, 16 Jul 2017 15:58:15 +0000 (UTC) From: Christopher Baines Date: Sun, 16 Jul 2017 16:58:15 +0100 Message-Id: <20170716155815.14496-1-mail@cbaines.net> X-Mailer: git-send-email 2.13.1 In-Reply-To: <87shi1etui.fsf@gnu.org> References: <87shi1etui.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/tests/web.scm: New file. --- gnu/local.mk | 1 + gnu/tests/admin.scm | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 gnu/tests/admin.scm diff --git a/gnu/local.mk b/gnu/local.mk index 50fac3040..4bb7ce901 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -476,6 +476,7 @@ GNU_SYSTEM_MODULES = \ %D%/build/vm.scm \ \ %D%/tests.scm \ + %D%/tests/admin.scm \ %D%/tests/base.scm \ %D%/tests/dict.scm \ %D%/tests/nfs.scm \ diff --git a/gnu/tests/admin.scm b/gnu/tests/admin.scm new file mode 100644 index 000000000..5e2424bdb --- /dev/null +++ b/gnu/tests/admin.scm @@ -0,0 +1,96 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Christopher Baines +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests admin) + #:use-module (gnu tests) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system shadow) + #:use-module (gnu system vm) + #:use-module (gnu services) + #:use-module (gnu services admin) + #:use-module (gnu services networking) + #:use-module (guix gexp) + #:use-module (guix store) + #:use-module (guix monads) + #:export (%test-tailon)) + +(define %tailon-os + ;; Operating system under test. + (simple-operating-system + (dhcp-client-service) + (service tailon-service-type))) + +(define* (run-tailon-test #:optional (http-port 8042)) + "Run tests in %TAILON-OS, which has tailon running and listening on +HTTP-PORT." + (mlet* %store-monad ((os -> (marionette-operating-system + %tailon-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + (command (system-qemu-image/shared-store-script + os #:graphic? #f))) + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-11) (srfi srfi-64) + (gnu build marionette) + (web uri) + (web client) + (web response)) + + (define marionette + ;; Forward the guest's HTTP-PORT, where tailon is listening, to + ;; port 8080 in the host. + (make-marionette (list #$command "-net" + (string-append + "user,hostfwd=tcp::8080-:" + #$(number->string http-port))))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "tailon") + + ;; Wait for tailon to be up and running. + (test-eq "service running" + 'running! + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'tailon) + 'running!) + marionette)) + + (test-equal "http-get" + 200 + (let-values (((response text) + (http-get "http://localhost:8080/" + #:decode-body? #t))) + (response-code response))) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "tailon-test" test))) + +(define %test-tailon + (system-test + (name "tailon") + (description "Connect to a running Tailon server.") + (value (run-tailon-test)))) -- 2.13.1 From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Jul 2017 08:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150028082415659 (code B ref 27650); Mon, 17 Jul 2017 08:41:02 +0000 Received: (at 27650) by debbugs.gnu.org; 17 Jul 2017 08:40:24 +0000 Received: from localhost ([127.0.0.1]:43186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX1Zo-00044V-97 for submit@debbugs.gnu.org; Mon, 17 Jul 2017 04:40:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX1Zm-00044G-IM for 27650@debbugs.gnu.org; Mon, 17 Jul 2017 04:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1Zd-0003Xl-Bw for 27650@debbugs.gnu.org; Mon, 17 Jul 2017 04:40:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Zd-0003Xb-9Q; Mon, 17 Jul 2017 04:40:13 -0400 Received: from [193.50.110.212] (port=51274 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dX1Zc-0003rS-Q9; Mon, 17 Jul 2017 04:40:13 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170711065634.9717-1-mail@cbaines.net> <87shi1etui.fsf@gnu.org> <20170716165149.48c2fe19@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 29 Messidor an 225 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Mon, 17 Jul 2017 10:40:11 +0200 In-Reply-To: <20170716165149.48c2fe19@cbaines.net> (Christopher Baines's message of "Sun, 16 Jul 2017 16:51:49 +0100") Message-ID: <87mv83e9sk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > On Wed, 12 Jul 2017 14:13:25 +0200 [...] >> Bonus points if you write a system test that checks that at least the >> Web server shows up on port 8080. > > I've had a go at this, I'll send a separate patch. It doesn't pass for > me yet, and I'm not sure how to work out what is going on inside the > test system, does anyone have any tips for writing and debugging system > tests in general? No specific tips. Beware of QEMU port forwarding: it doesn=E2=80=99t allow= you to really diagnose what=E2=80=99s going on if you can=E2=80=99t connect fro= m the host to the guest (it=E2=80=99s hard to tell if that=E2=80=99s because the service = in the guest is not running.) So on a few occasions I found that I=E2=80=99d first try connecting from within the guest as my first attempt (using =E2=80=98marionette-eval=E2=80=99), to see if this would work at all. Sometimes you=E2=80=99ll also want to just run a VM of the system under test interactively so experiment a bit. HTH, Ludo=E2=80=99. From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Jul 2017 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150028518922257 (code B ref 27650); Mon, 17 Jul 2017 09:54:01 +0000 Received: (at 27650) by debbugs.gnu.org; 17 Jul 2017 09:53:09 +0000 Received: from localhost ([127.0.0.1]:43251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX2iD-0005mv-Ln for submit@debbugs.gnu.org; Mon, 17 Jul 2017 05:53:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX2iB-0005mi-PL for 27650@debbugs.gnu.org; Mon, 17 Jul 2017 05:53:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX2i3-00022V-A2 for 27650@debbugs.gnu.org; Mon, 17 Jul 2017 05:53:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX2i3-00022R-5z; Mon, 17 Jul 2017 05:52:59 -0400 Received: from [193.50.110.212] (port=51362 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dX2i2-0002I0-N1; Mon, 17 Jul 2017 05:52:59 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87shi1etui.fsf@gnu.org> <20170716155226.13689-1-mail@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 29 Messidor an 225 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Mon, 17 Jul 2017 11:52:57 +0200 In-Reply-To: <20170716155226.13689-1-mail@cbaines.net> (Christopher Baines's message of "Sun, 16 Jul 2017 16:52:26 +0100") Message-ID: <87r2xfbdae.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > * gnu/services/admin.scm > (, ): New record types. > (tailon-configuration-files-string, tailon-shepherd-service): New > procedures. > (%tailon-accounts, tailon-service-type: New variables. > * doc/guix.texi (Monitoring Services: Document the Tailon service. [...] > +@deftp {Data Type} tailon-configuration-file > +Data type representing the configuration options for Tailon. > +This type has the following parameters: > + > +@table @asis > +@item @code{files} (default: @code{(list "/var/log")}) > +List of files to display. The list can include strings for a single > +file, or a list, where the first item is the name of a subsection, and s/file/file or directory/ (I assume it recurses into directories?) > +@item @code{relative-root-path} (default: @code{#f}) > +Prefix to use for all paths, set to @code{#f} to disable using a prefix. s/path/directory/ :-) OK to push with these changes, thank you! Ludo=E2=80=99. From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] tests: Add 'tailon-service-type' test. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Jul 2017 09:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150028522622310 (code B ref 27650); Mon, 17 Jul 2017 09:54:02 +0000 Received: (at 27650) by debbugs.gnu.org; 17 Jul 2017 09:53:46 +0000 Received: from localhost ([127.0.0.1]:43254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX2in-0005nm-U6 for submit@debbugs.gnu.org; Mon, 17 Jul 2017 05:53:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX2ik-0005nW-Uq for 27650@debbugs.gnu.org; Mon, 17 Jul 2017 05:53:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX2ib-0002Mx-S8 for 27650@debbugs.gnu.org; Mon, 17 Jul 2017 05:53:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX2ib-0002Mt-OS; Mon, 17 Jul 2017 05:53:33 -0400 Received: from [193.50.110.212] (port=51364 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dX2ib-0002Jt-AY; Mon, 17 Jul 2017 05:53:33 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87shi1etui.fsf@gnu.org> <20170716155815.14496-1-mail@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 29 Messidor an 225 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Mon, 17 Jul 2017 11:53:31 +0200 In-Reply-To: <20170716155815.14496-1-mail@cbaines.net> (Christopher Baines's message of "Sun, 16 Jul 2017 16:58:15 +0100") Message-ID: <87mv83bd9g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > * gnu/tests/web.scm: New file. Nice! LGTM, thank you! Ludo=E2=80=99. From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH 1/2] gnu: services: admin: Add tailon. References: <20170711065634.9717-1-mail@cbaines.net> In-Reply-To: <20170711065634.9717-1-mail@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Jul 2017 09:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150106013829269 (code B ref 27650); Wed, 26 Jul 2017 09:09:01 +0000 Received: (at 27650) by debbugs.gnu.org; 26 Jul 2017 09:08:58 +0000 Received: from localhost ([127.0.0.1]:56756 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daIJN-0007c1-Ry for submit@debbugs.gnu.org; Wed, 26 Jul 2017 05:08:58 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:60254 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daIJL-0007bn-Jg for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 05:08:56 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 10F6A13D230; Wed, 26 Jul 2017 10:08:54 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 8468513D068 for <27650@debbugs.gnu.org>; Wed, 26 Jul 2017 10:08:53 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 04a6657d for <27650@debbugs.gnu.org>; Wed, 26 Jul 2017 09:08:53 +0000 (UTC) From: Christopher Baines Date: Wed, 26 Jul 2017 10:08:52 +0100 Message-Id: <20170726090853.8987-1-mail@cbaines.net> X-Mailer: git-send-email 2.13.3 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/services/admin.scm (, ): New record types. (tailon-configuration-files-string, tailon-shepherd-service): New procedures. (%tailon-accounts, tailon-service-type: New variables. * doc/guix.texi (Monitoring Services: Document the Tailon service. --- doc/guix.texi | 90 +++++++++++++++++++++++++++++ gnu/services/admin.scm | 151 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 240 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index e8c4e0eaf..345285031 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -219,6 +219,7 @@ Services * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -9011,6 +9012,7 @@ declaration. * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -13599,6 +13601,94 @@ string, you could instantiate a prosody service like this: (prosody.cfg.lua ""))) @end example +@node Monitoring Services +@subsubsection Monitoring Services + +@subsubheading Tailon Service + +@uref{https://tailon.readthedocs.io/, Tailon} is a web application for +viewing and searching log files. + +The following example will configure the service with default values. +By default, Tailon can be accessed on port 8080 (@code{http://localhost:8080}). + +@example +(service tailon-service-type) +@end example + +The following example customises more of the Tailon configuration, +adding @command{sed} to the list of allowed commands. + +@example +(service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (allowed-commands '("tail" "grep" "awk" "sed")))))) +@end example + + +@deftp {Data Type} tailon-configuration +Data type representing the configuration of Tailon. +This type has the following parameters: + +@table @asis +@item @code{config-file} (default: @code{(tailon-configuration-file)}) +The configuration file to use for Tailon. This can be set to a +@dfn{tailon-configuration-file} record value, or any gexp +(@pxref{G-Expressions}). + +For example, to instead use a local file, the @code{local-file} function +can be used: + +@example +(service tailon-service-type + (tailon-configuration + (config-file (local-file "./my-tailon.conf")))) +@end example + +@item @code{package} (default: @code{tailon}) +The tailon package to use. + +@end table +@end deftp + +@deftp {Data Type} tailon-configuration-file +Data type representing the configuration options for Tailon. +This type has the following parameters: + +@table @asis +@item @code{files} (default: @code{(list "/var/log")}) +List of files to display. The list can include strings for a single file +or directory, or a list, where the first item is the name of a +subsection, and the remaining items are the files or directories in that +subsection. + +@item @code{bind} (default: @code{"localhost:8080"}) +Address and port to which Tailon should bind on. + +@item @code{relative-root} (default: @code{#f}) +URL path to use for Tailon, set to @code{#f} to not use a path. + +@item @code{allow-transfers?} (default: @code{#t}) +Allow downloading the log files in the web interface. + +@item @code{follow-names?} (default: @code{#t}) +Allow tailing of not-yet existent files. + +@item @code{tail-lines} (default: @code{200}) +Number of lines to read initially from each file. + +@item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")}) +Commands to allow running. By default, @code{sed} is disabled. + +@item @code{debug?} (default: @code{#f}) +Set @code{debug?} to @code{#t} to show debug messages. + +@end table +@end deftp + + @node Kerberos Services @subsubsection Kerberos Services @cindex Kerberos diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index b9e3fa70a..1044833fe 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -20,14 +20,19 @@ (define-module (gnu services admin) #:use-module (gnu packages admin) #:use-module (gnu packages base) + #:use-module (gnu packages logging) #:use-module (gnu services) #:use-module (gnu services mcron) #:use-module (gnu services shepherd) + #:use-module (gnu services web) + #:use-module (gnu system shadow) #:use-module (guix gexp) + #:use-module (guix store) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 vlist) + #:use-module (ice-9 match) #:export (%default-rotations %rotated-files @@ -41,7 +46,27 @@ rottlog-configuration rottlog-configuration? rottlog-service - rottlog-service-type)) + rottlog-service-type + + + tailon-configuration-file + tailon-configuration-file? + tailon-configuration-file-files + tailon-configuration-file-bind + tailon-configuration-file-relative-root + tailon-configuration-file-allow-transfers? + tailon-configuration-file-follow-names? + tailon-configuration-file-tail-lines + tailon-configuration-file-allowed-commands + tailon-configuration-file-debug? + + + tailon-configuration + tailon-configuration? + tailon-configuration-config-file + tailon-configuration-package + + tailon-service-type)) ;;; Commentary: ;;; @@ -172,4 +197,128 @@ for ROTATION." rotations))))) (default-value (rottlog-configuration)))) + +;;; +;;; Tailon +;;; + +(define-record-type* + tailon-configuration-file make-tailon-configuration-file + tailon-configuration-file? + (files tailon-configuration-file-files + (default '("/var/log"))) + (bind tailon-configuration-file-bind + (default "localhost:8080")) + (relative-root tailon-configuration-file-relative-root + (default #f)) + (allow-transfers? tailon-configuration-file-allow-transfers? + (default #t)) + (follow-names? tailon-configuration-file-follow-names? + (default #t)) + (tail-lines tailon-configuration-file-tail-lines + (default 200)) + (allowed-commands tailon-configuration-file-allowed-commands + (default '("tail" "grep" "awk"))) + (debug? tailon-configuration-file-debug? + (default #f))) + +(define (tailon-configuration-files-string files) + (string-append + "\n" + (string-join + (map + (lambda (x) + (string-append + " - " + (cond + ((string? x) + (simple-format #f "'~A'" x)) + ((list? x) + (string-join + (cons (simple-format #f "'~A':" (car x)) + (map + (lambda (x) (simple-format #f " - '~A'" x)) + (cdr x))) + "\n")) + (else (error x))))) + files) + "\n"))) + +(define-gexp-compiler (tailon-configuration-file-compiler + (file ) system target) + (match file + (($ files bind relative-root + allow-transfers? follow-names? + tail-lines allowed-commands debug?) + (text-file + "tailon-config.yaml" + (string-concatenate + (filter-map + (match-lambda + ((key . #f) #f) + ((key . value) (string-append key ": " value "\n"))) + + `(("files" . ,(tailon-configuration-files-string files)) + ("bind" . ,bind) + ("relative-root" . ,relative-root) + ("allow-transfers" . ,(if allow-transfers? "true" "false")) + ("follow-names" . ,(if follow-names? "true" "false")) + ("tail-lines" . ,(number->string tail-lines)) + ("commands" . ,(string-append "[" + (string-join allowed-commands ", ") + "]")) + ,@(if debug? '(("debug" . "true")) '())))))))) + +(define-record-type* + tailon-configuration make-tailon-configuration + tailon-configuration? + (config-file tailon-configuration-config-file + (default (tailon-configuration-file))) + (package tailon-configuration-package + (default tailon))) + +(define tailon-shepherd-service + (match-lambda + (($ config-file package) + (list (shepherd-service + (provision '(tailon)) + (documentation "Run the tailon daemon.") + (start #~(make-forkexec-constructor + `(,(string-append #$package "/bin/tailon") + "-c" ,#$config-file) + #:user "tailon" + #:group "tailon")) + (stop #~(make-kill-destructor))))))) + +(define %tailon-accounts + (list (user-group (name "tailon") (system? #t)) + (user-account + (name "tailon") + (group "tailon") + (system? #t) + (comment "tailon") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define tailon-service-type + (service-type + (name 'tailon) + (extensions + (list (service-extension shepherd-root-service-type + tailon-shepherd-service) + (service-extension account-service-type + (const %tailon-accounts)))) + (compose concatenate) + (extend (lambda (parameter files) + (tailon-configuration + (inherit parameter) + (config-file + (let ((old-config-file + (tailon-configuration-config-file parameter))) + (tailon-configuration-file + (inherit old-config-file) + (files (append (tailon-configuration-file-files old-config-file) + files)))))))) + (default-value (tailon-configuration)))) + ;;; admin.scm ends here -- 2.13.3 From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Jul 2017 09:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150106014329329 (code B ref 27650); Wed, 26 Jul 2017 09:10:02 +0000 Received: (at 27650) by debbugs.gnu.org; 26 Jul 2017 09:09:03 +0000 Received: from localhost ([127.0.0.1]:56763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daIJS-0007cv-KS for submit@debbugs.gnu.org; Wed, 26 Jul 2017 05:09:02 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:60255 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daIJL-0007bo-Jg for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 05:08:59 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 3AFC513D068; Wed, 26 Jul 2017 10:08:54 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 9711D13D22F for <27650@debbugs.gnu.org>; Wed, 26 Jul 2017 10:08:53 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 7464779e for <27650@debbugs.gnu.org>; Wed, 26 Jul 2017 09:08:53 +0000 (UTC) From: Christopher Baines Date: Wed, 26 Jul 2017 10:08:53 +0100 Message-Id: <20170726090853.8987-2-mail@cbaines.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170726090853.8987-1-mail@cbaines.net> References: <20170726090853.8987-1-mail@cbaines.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/tests/web.scm: New file. --- gnu/local.mk | 1 + gnu/tests/admin.scm | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 gnu/tests/admin.scm diff --git a/gnu/local.mk b/gnu/local.mk index 9dfca9dbb..90dfcfeb5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -479,6 +479,7 @@ GNU_SYSTEM_MODULES = \ %D%/build/vm.scm \ \ %D%/tests.scm \ + %D%/tests/admin.scm \ %D%/tests/base.scm \ %D%/tests/dict.scm \ %D%/tests/nfs.scm \ diff --git a/gnu/tests/admin.scm b/gnu/tests/admin.scm new file mode 100644 index 000000000..06373be14 --- /dev/null +++ b/gnu/tests/admin.scm @@ -0,0 +1,106 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Christopher Baines +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests admin) + #:use-module (gnu tests) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system shadow) + #:use-module (gnu system vm) + #:use-module (gnu services) + #:use-module (gnu services admin) + #:use-module (gnu services networking) + #:use-module (guix gexp) + #:use-module (guix store) + #:use-module (guix monads) + #:export (%test-tailon)) + +(define %tailon-os + ;; Operating system under test. + (simple-operating-system + (dhcp-client-service) + (service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (bind "0.0.0.0:8080"))))))) + +(define* (run-tailon-test #:optional (http-port 8081)) + "Run tests in %TAILON-OS, which has tailon running and listening on +HTTP-PORT." + (mlet* %store-monad ((os -> (marionette-operating-system + %tailon-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + (command (system-qemu-image/shared-store-script + os #:graphic? #f))) + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-11) (srfi srfi-64) + (gnu build marionette) + (web uri) + (web client) + (web response)) + + (define marionette + ;; Forward the guest's HTTP-PORT, where tailon is listening, to + ;; port 8080 in the host. + (make-marionette (list #$command "-net" + #$(simple-format + #f + "user,hostfwd=tcp::~A-:8080" + http-port)))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "tailon") + + (test-eq "service running" + 'running! + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'tailon) + 'running!) + marionette)) + + ;; Wait for tailon to be up and running. + (sleep 5) + + (test-equal "http-get" + 200 + (let-values (((response text) + (http-get #$(simple-format + #f + "http://localhost:~A/" + http-port) + #:decode-body? #t))) + (response-code response))) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "tailon-test" test))) + +(define %test-tailon + (system-test + (name "tailon") + (description "Connect to a running Tailon server.") + (value (run-tailon-test)))) -- 2.13.3 From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Jul 2017 09:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.1501062624384 (code B ref 27650); Wed, 26 Jul 2017 09:51:01 +0000 Received: (at 27650) by debbugs.gnu.org; 26 Jul 2017 09:50:24 +0000 Received: from localhost ([127.0.0.1]:56772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daIxU-000067-37 for submit@debbugs.gnu.org; Wed, 26 Jul 2017 05:50:24 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:32886 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daIxQ-00005x-4F for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 05:50:21 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 1483B13D22F; Wed, 26 Jul 2017 10:50:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 097CC13D068; Wed, 26 Jul 2017 10:50:18 +0100 (BST) Date: Wed, 26 Jul 2017 10:50:09 +0100 From: Christopher Baines Message-ID: <20170726105009.14461c68@cbaines.net> In-Reply-To: <87r2xfbdae.fsf@gnu.org> References: <87shi1etui.fsf@gnu.org> <20170716155226.13689-1-mail@cbaines.net> <87r2xfbdae.fsf@gnu.org> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/6z/E.adBz+3LYIQKuHnoKOR"; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Sig_/6z/E.adBz+3LYIQKuHnoKOR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 17 Jul 2017 11:52:57 +0200 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Christopher Baines skribis: >=20 > > * gnu/services/admin.scm > > (, ): New record > > types. (tailon-configuration-files-string, > > tailon-shepherd-service): New procedures. > > (%tailon-accounts, tailon-service-type: New variables. > > * doc/guix.texi (Monitoring Services: Document the Tailon service. =20 >=20 > [...] >=20 > > +@deftp {Data Type} tailon-configuration-file > > +Data type representing the configuration options for Tailon. > > +This type has the following parameters: > > + > > +@table @asis > > +@item @code{files} (default: @code{(list "/var/log")}) > > +List of files to display. The list can include strings for a single > > +file, or a list, where the first item is the name of a subsection, > > and =20 >=20 > s/file/file or directory/ (I assume it recurses into directories?) Yep, it shows the files in the directory. I've sent an updated patch with this change. > > +@item @code{relative-root-path} (default: @code{#f}) > > +Prefix to use for all paths, set to @code{#f} to disable using a > > prefix. =20 >=20 > s/path/directory/ :-) So, it turns out I'd completely misinterpreted this option, I was thinking it was about the log files, as in you would set it to /var/log if you wanted to specify filenames relative to there. That is wrong, its actually about the URL path, so if you want to have Tailon at http://localhost/tailon/ you set the relative-root to /tailon/. I've now updated the code and docs for this. > OK to push with these changes, thank you! I've sent the two patches again. I also was able to debug the issue I was having with the system test, I needed to get Tailon to bind to 0.0.0.0, rather than localhost for it to work, and with that change, the system test works! --Sig_/6z/E.adBz+3LYIQKuHnoKOR Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAll4ZdFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9Xf/HQ//e0dQ30tMHAE7abkYoDB62uFOaDLbn2UFFf982Ho7V5/7Enq76eejZwuw 7PiXfnRK97L6COq/QZpd3N/tBYjjvbz07P9bFhAmNU01TWzX9CyJMVkE9defMnlA V3B/HGallzOlWVoMuYwbiR1NYEnPphpXTps/D/bQPTELjm8mXnnGrUUopYy/ns+h P6+dSg/Qe655waAIwnXrxN51QK5zcnCyi793drKbwpN7yXmLGBOgnvBj0urczJ+e xoDlJAPqR7eZ+paT69aLFMnZ5oHA5VB8sY07gUEARQJxJNofDmMRvma1pPPqr+5U ghffTX463CHLFYiWeOix+PG410XFp6vjKsXe/N36jpUWHPH2HC61lzbmwKSve7lP 2ocATREHwHv8dgkTByo5ib3tYOjn0Xl9z80IwwmCq1iZkkl7mUstIfY0dC8KD8lL brdCDi02qX4HzyBwAhqCcs75s1vmSBoDBqTEO9iHyFjR2vFkdILdOoOn5Xb1Jo4b cudGhsxm6M7Kqz0Dcvuh2uu6bWCUo9fFnyukaRPttS/6ntn9GbpcFDyIZRjhSxkz NiRZFE/KZxGXOkFnz9GIoPUSTJJ9i0cJtbP0GY+mTyvzP6B8Zt6YP4G2ji660W1n 24GqXX+D7e7ghUjcFpG11LKg41xc6VbjXtuNiHpiP/AMWwjDjjg= =miH8 -----END PGP SIGNATURE----- --Sig_/6z/E.adBz+3LYIQKuHnoKOR-- From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH 1/2] gnu: services: admin: Add tailon. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Jul 2017 20:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.15011016661191 (code B ref 27650); Wed, 26 Jul 2017 20:42:01 +0000 Received: (at 27650) by debbugs.gnu.org; 26 Jul 2017 20:41:06 +0000 Received: from localhost ([127.0.0.1]:57717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daT7C-0000J8-5Y for submit@debbugs.gnu.org; Wed, 26 Jul 2017 16:41:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daT7A-0000IZ-QB for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 16:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daT72-0007D1-KY for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 16:40:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daT72-0007Cx-Go; Wed, 26 Jul 2017 16:40:56 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:44460 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1daT71-00044N-TK; Wed, 26 Jul 2017 16:40:56 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170711065634.9717-1-mail@cbaines.net> <20170726090853.8987-1-mail@cbaines.net> Date: Wed, 26 Jul 2017 22:40:53 +0200 In-Reply-To: <20170726090853.8987-1-mail@cbaines.net> (Christopher Baines's message of "Wed, 26 Jul 2017 10:08:52 +0100") Message-ID: <878tjb7wyy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > * gnu/services/admin.scm > (, ): New record types. > (tailon-configuration-files-string, tailon-shepherd-service): New > procedures. > (%tailon-accounts, tailon-service-type: New variables. > * doc/guix.texi (Monitoring Services: Document the Tailon service. LGTM! From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Jul 2017 20:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.15011020151712 (code B ref 27650); Wed, 26 Jul 2017 20:47:01 +0000 Received: (at 27650) by debbugs.gnu.org; 26 Jul 2017 20:46:55 +0000 Received: from localhost ([127.0.0.1]:57722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daTCo-0000RY-Re for submit@debbugs.gnu.org; Wed, 26 Jul 2017 16:46:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daTCk-0000RH-PV for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 16:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daTCb-00038C-48 for 27650@debbugs.gnu.org; Wed, 26 Jul 2017 16:46:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daTCb-00037z-1M; Wed, 26 Jul 2017 16:46:41 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:44500 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1daTCa-0005Ai-Cr; Wed, 26 Jul 2017 16:46:40 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170726090853.8987-1-mail@cbaines.net> <20170726090853.8987-2-mail@cbaines.net> Date: Wed, 26 Jul 2017 22:46:37 +0200 In-Reply-To: <20170726090853.8987-2-mail@cbaines.net> (Christopher Baines's message of "Wed, 26 Jul 2017 10:08:53 +0100") Message-ID: <87379j7wpe.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > * gnu/tests/web.scm: New file. [...] > +(define* (run-tailon-test #:optional (http-port 8081)) > + "Run tests in %TAILON-OS, which has tailon running and listening on > +HTTP-PORT." > + (mlet* %store-monad ((os -> (marionette-operating-system > + %tailon-os > + #:imported-modules '((gnu services herd) > + (guix combinators)= ))) > + (command (system-qemu-image/shared-store-script > + os #:graphic? #f))) [...] > + (define marionette > + ;; Forward the guest's HTTP-PORT, where tailon is listenin= g, to > + ;; port 8080 in the host. > + (make-marionette (list #$command "-net" > + #$(simple-format > + #f > + "user,hostfwd=3Dtcp::~A-:8080" > + http-port)))) This can be simplified using the new =E2=80=98virtual-machine=E2=80=99 obje= cts: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27751 Could you give it a try? > + (test-equal "http-get" > + 200 > + (let-values (((response text) > + (http-get #$(simple-format > + #f > + "http://localhost:~A/" > + http-port) > + #:decode-body? #t))) > + (response-code response))) If there was a more specific API, like a rest API to check whether a specific log file exists, perhaps that=E2=80=99d be a good extra test. Otherwise that=E2=80=99s fine. BTW, it=E2=80=99s enough to use =E2=80=98format=E2=80=99 rather than =E2=80= =98simple-format=E2=80=99 here: it=E2=80=99s (roughly) equivalent and incurs less typing. :-) Feel free to squeeze this patch with the previous one (thus making a self-contained commit), or leave it separately if it=E2=80=99s more conveni= ent for you. Thanks for taking the time to write this test! Ludo=E2=80=99. From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH 2/2] tests: Add 'tailon-service-type' test. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 Jul 2017 17:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.15011768184592 (code B ref 27650); Thu, 27 Jul 2017 17:34:02 +0000 Received: (at 27650) by debbugs.gnu.org; 27 Jul 2017 17:33:38 +0000 Received: from localhost ([127.0.0.1]:58869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1damfK-0001Bz-Bh for submit@debbugs.gnu.org; Thu, 27 Jul 2017 13:33:38 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:53279 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1damfF-0001Bo-Ac for 27650@debbugs.gnu.org; Thu, 27 Jul 2017 13:33:36 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id ED77413D22F; Thu, 27 Jul 2017 18:33:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id D108A13D1D1; Thu, 27 Jul 2017 18:33:29 +0100 (BST) Date: Thu, 27 Jul 2017 18:33:26 +0100 From: Christopher Baines Message-ID: <20170727183326.23045a4a@cbaines.net> In-Reply-To: <87379j7wpe.fsf@gnu.org> References: <20170726090853.8987-1-mail@cbaines.net> <20170726090853.8987-2-mail@cbaines.net> <87379j7wpe.fsf@gnu.org> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/O.igqtjAQV/0cu0xfeNH0O+"; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Sig_/O.igqtjAQV/0cu0xfeNH0O+ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 26 Jul 2017 22:46:37 +0200 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Christopher Baines skribis: >=20 > > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > > * gnu/tests/web.scm: New file. =20 >=20 > [...] >=20 > > +(define* (run-tailon-test #:optional (http-port 8081)) > > + "Run tests in %TAILON-OS, which has tailon running and listening > > on +HTTP-PORT." > > + (mlet* %store-monad ((os -> (marionette-operating-system > > + %tailon-os > > + #:imported-modules '((gnu > > services herd) > > + (guix > > combinators)))) > > + (command > > (system-qemu-image/shared-store-script > > + os #:graphic? #f))) =20 >=20 >=20 > [...] >=20 > > + (define marionette > > + ;; Forward the guest's HTTP-PORT, where tailon is > > listening, to > > + ;; port 8080 in the host. > > + (make-marionette (list #$command "-net" > > + #$(simple-format > > + #f > > + > > "user,hostfwd=3Dtcp::~A-:8080" > > + http-port)))) =20 >=20 > This can be simplified using the new =E2=80=98virtual-machine=E2=80=99 ob= jects: >=20 > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27751 >=20 > Could you give it a try? Yep, I'll send an updated patch that switches to use this approach. > > + (test-equal "http-get" > > + 200 > > + (let-values (((response text) > > + (http-get #$(simple-format > > + #f > > + "http://localhost:~A/" > > + http-port) > > + #:decode-body? #t))) > > + (response-code response))) =20 >=20 > If there was a more specific API, like a rest API to check whether a > specific log file exists, perhaps that=E2=80=99d be a good extra test. > Otherwise that=E2=80=99s fine. I'm not sure there is an API, but I'll have a think about more useful testing approaches. Maybe checking for things in the response, or trying to run Tailon's test suite... > BTW, it=E2=80=99s enough to use =E2=80=98format=E2=80=99 rather than =E2= =80=98simple-format=E2=80=99 here: > it=E2=80=99s (roughly) equivalent and incurs less typing. :-) Ok, I'll change to use format. > Feel free to squeeze this patch with the previous one (thus making a > self-contained commit), or leave it separately if it=E2=80=99s more conve= nient > for you. Squashing them is fine, I'll do this. > Thanks for taking the time to write this test! No problem, thanks for your and everyone elses advice on QEMU on IRC, it was very useful. Also, I've removed the sleep, and replaced it with a function to retry the connection on error, which should hopefully avoid any issues with it failing just because Tailon hasn't finished starting yet. --Sig_/O.igqtjAQV/0cu0xfeNH0O+ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAll6I+ZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XdKRA//YSvaIIdmWGJLxV4HsyPDHKDUADMAh3qEWryFjJBiAoYYDyecpiLqRLLq Rr7HvnnEffx6JAUIDb3Rm5y/mGg+v7VYYWFCIDWnwO9s8yjd8FXLZJNx3Ft/nrY1 SQapJpt3CdlQTZubSb8f4vQxGG23uMyvm8MET94UxXyRFnKuClfEDTHpu9D2nGJo KPZEWwb5qhIx7kXxs3imoRkO/a1hffXhqdV9l/u5oUTDykor+B4tANUB7WBRoZpK 8KM1e2Jk02W34glDVsUD5Z0VI6/36ZItkXby8VdhFbDrlK+cVoiY6nSBvSq/FYG3 mUfX7wMBZAGdTWj5vDEb5JRY+R4mE6gNsbLpGHX3k6W43u47K+ZkYUjOHO8v/JMe GOTqlYH1D3jLZecgcLD7XjBH22CYxRItgMuuxrESMEuEoAwACuyj+ar/r9jwG+j/ PlCJ6xMxEkgTC7++wTxNIRDc8Z+9u9DLB8tjujKeGlVTT6GPSFSKQOvO3SE+BqVm UWWmxNCH6iKmfulOMy2xFr+GaYWhvIB/uir7Jzxv09S+JuppNSrCUw0dYi4sN3Ci yZwfLa/wmmguNuL0X1u7BT+ANms42RlkWISacO2ap7/p08NFZW1URVjwiDMo6D2j m1+Gqf9aohdZMqRPBml4NcuhwCoyxGwJ1j1OVF1LpOlpyXQSzlk= =9791 -----END PGP SIGNATURE----- --Sig_/O.igqtjAQV/0cu0xfeNH0O+-- From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 Jul 2017 17:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.15011769134753 (code B ref 27650); Thu, 27 Jul 2017 17:36:01 +0000 Received: (at 27650) by debbugs.gnu.org; 27 Jul 2017 17:35:13 +0000 Received: from localhost ([127.0.0.1]:58873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1damgq-0001Ea-Og for submit@debbugs.gnu.org; Thu, 27 Jul 2017 13:35:13 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:53285 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1damgm-0001EQ-6m for 27650@debbugs.gnu.org; Thu, 27 Jul 2017 13:35:11 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id C304713D22F; Thu, 27 Jul 2017 18:35:07 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 2FB7313D1D1 for <27650@debbugs.gnu.org>; Thu, 27 Jul 2017 18:35:07 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 5c66c8ce for <27650@debbugs.gnu.org>; Thu, 27 Jul 2017 17:35:06 +0000 (UTC) From: Christopher Baines Date: Thu, 27 Jul 2017 18:35:06 +0100 Message-Id: <20170727173506.23641-1-mail@cbaines.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <87379j7wpe.fsf@gnu.org> References: <87379j7wpe.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) * gnu/services/admin.scm (, ): New record types. (tailon-configuration-files-string, tailon-shepherd-service): New procedures. (%tailon-accounts, tailon-service-type: New variables. * doc/guix.texi (Monitoring Services: Document the Tailon service. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/tests/admin.scm: New file. --- doc/guix.texi | 90 +++++++++++++++++++++++++++++ gnu/local.mk | 1 + gnu/services/admin.scm | 151 ++++++++++++++++++++++++++++++++++++++++++++++++- gnu/tests/admin.scm | 128 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 369 insertions(+), 1 deletion(-) create mode 100644 gnu/tests/admin.scm diff --git a/doc/guix.texi b/doc/guix.texi index e8c4e0eaf..345285031 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -219,6 +219,7 @@ Services * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -9011,6 +9012,7 @@ declaration. * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -13599,6 +13601,94 @@ string, you could instantiate a prosody service like this: (prosody.cfg.lua ""))) @end example +@node Monitoring Services +@subsubsection Monitoring Services + +@subsubheading Tailon Service + +@uref{https://tailon.readthedocs.io/, Tailon} is a web application for +viewing and searching log files. + +The following example will configure the service with default values. +By default, Tailon can be accessed on port 8080 (@code{http://localhost:8080}). + +@example +(service tailon-service-type) +@end example + +The following example customises more of the Tailon configuration, +adding @command{sed} to the list of allowed commands. + +@example +(service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (allowed-commands '("tail" "grep" "awk" "sed")))))) +@end example + + +@deftp {Data Type} tailon-configuration +Data type representing the configuration of Tailon. +This type has the following parameters: + +@table @asis +@item @code{config-file} (default: @code{(tailon-configuration-file)}) +The configuration file to use for Tailon. This can be set to a +@dfn{tailon-configuration-file} record value, or any gexp +(@pxref{G-Expressions}). + +For example, to instead use a local file, the @code{local-file} function +can be used: + +@example +(service tailon-service-type + (tailon-configuration + (config-file (local-file "./my-tailon.conf")))) +@end example + +@item @code{package} (default: @code{tailon}) +The tailon package to use. + +@end table +@end deftp + +@deftp {Data Type} tailon-configuration-file +Data type representing the configuration options for Tailon. +This type has the following parameters: + +@table @asis +@item @code{files} (default: @code{(list "/var/log")}) +List of files to display. The list can include strings for a single file +or directory, or a list, where the first item is the name of a +subsection, and the remaining items are the files or directories in that +subsection. + +@item @code{bind} (default: @code{"localhost:8080"}) +Address and port to which Tailon should bind on. + +@item @code{relative-root} (default: @code{#f}) +URL path to use for Tailon, set to @code{#f} to not use a path. + +@item @code{allow-transfers?} (default: @code{#t}) +Allow downloading the log files in the web interface. + +@item @code{follow-names?} (default: @code{#t}) +Allow tailing of not-yet existent files. + +@item @code{tail-lines} (default: @code{200}) +Number of lines to read initially from each file. + +@item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")}) +Commands to allow running. By default, @code{sed} is disabled. + +@item @code{debug?} (default: @code{#f}) +Set @code{debug?} to @code{#t} to show debug messages. + +@end table +@end deftp + + @node Kerberos Services @subsubsection Kerberos Services @cindex Kerberos diff --git a/gnu/local.mk b/gnu/local.mk index 9dfca9dbb..90dfcfeb5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -479,6 +479,7 @@ GNU_SYSTEM_MODULES = \ %D%/build/vm.scm \ \ %D%/tests.scm \ + %D%/tests/admin.scm \ %D%/tests/base.scm \ %D%/tests/dict.scm \ %D%/tests/nfs.scm \ diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index b9e3fa70a..1044833fe 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -20,14 +20,19 @@ (define-module (gnu services admin) #:use-module (gnu packages admin) #:use-module (gnu packages base) + #:use-module (gnu packages logging) #:use-module (gnu services) #:use-module (gnu services mcron) #:use-module (gnu services shepherd) + #:use-module (gnu services web) + #:use-module (gnu system shadow) #:use-module (guix gexp) + #:use-module (guix store) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 vlist) + #:use-module (ice-9 match) #:export (%default-rotations %rotated-files @@ -41,7 +46,27 @@ rottlog-configuration rottlog-configuration? rottlog-service - rottlog-service-type)) + rottlog-service-type + + + tailon-configuration-file + tailon-configuration-file? + tailon-configuration-file-files + tailon-configuration-file-bind + tailon-configuration-file-relative-root + tailon-configuration-file-allow-transfers? + tailon-configuration-file-follow-names? + tailon-configuration-file-tail-lines + tailon-configuration-file-allowed-commands + tailon-configuration-file-debug? + + + tailon-configuration + tailon-configuration? + tailon-configuration-config-file + tailon-configuration-package + + tailon-service-type)) ;;; Commentary: ;;; @@ -172,4 +197,128 @@ for ROTATION." rotations))))) (default-value (rottlog-configuration)))) + +;;; +;;; Tailon +;;; + +(define-record-type* + tailon-configuration-file make-tailon-configuration-file + tailon-configuration-file? + (files tailon-configuration-file-files + (default '("/var/log"))) + (bind tailon-configuration-file-bind + (default "localhost:8080")) + (relative-root tailon-configuration-file-relative-root + (default #f)) + (allow-transfers? tailon-configuration-file-allow-transfers? + (default #t)) + (follow-names? tailon-configuration-file-follow-names? + (default #t)) + (tail-lines tailon-configuration-file-tail-lines + (default 200)) + (allowed-commands tailon-configuration-file-allowed-commands + (default '("tail" "grep" "awk"))) + (debug? tailon-configuration-file-debug? + (default #f))) + +(define (tailon-configuration-files-string files) + (string-append + "\n" + (string-join + (map + (lambda (x) + (string-append + " - " + (cond + ((string? x) + (simple-format #f "'~A'" x)) + ((list? x) + (string-join + (cons (simple-format #f "'~A':" (car x)) + (map + (lambda (x) (simple-format #f " - '~A'" x)) + (cdr x))) + "\n")) + (else (error x))))) + files) + "\n"))) + +(define-gexp-compiler (tailon-configuration-file-compiler + (file ) system target) + (match file + (($ files bind relative-root + allow-transfers? follow-names? + tail-lines allowed-commands debug?) + (text-file + "tailon-config.yaml" + (string-concatenate + (filter-map + (match-lambda + ((key . #f) #f) + ((key . value) (string-append key ": " value "\n"))) + + `(("files" . ,(tailon-configuration-files-string files)) + ("bind" . ,bind) + ("relative-root" . ,relative-root) + ("allow-transfers" . ,(if allow-transfers? "true" "false")) + ("follow-names" . ,(if follow-names? "true" "false")) + ("tail-lines" . ,(number->string tail-lines)) + ("commands" . ,(string-append "[" + (string-join allowed-commands ", ") + "]")) + ,@(if debug? '(("debug" . "true")) '())))))))) + +(define-record-type* + tailon-configuration make-tailon-configuration + tailon-configuration? + (config-file tailon-configuration-config-file + (default (tailon-configuration-file))) + (package tailon-configuration-package + (default tailon))) + +(define tailon-shepherd-service + (match-lambda + (($ config-file package) + (list (shepherd-service + (provision '(tailon)) + (documentation "Run the tailon daemon.") + (start #~(make-forkexec-constructor + `(,(string-append #$package "/bin/tailon") + "-c" ,#$config-file) + #:user "tailon" + #:group "tailon")) + (stop #~(make-kill-destructor))))))) + +(define %tailon-accounts + (list (user-group (name "tailon") (system? #t)) + (user-account + (name "tailon") + (group "tailon") + (system? #t) + (comment "tailon") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define tailon-service-type + (service-type + (name 'tailon) + (extensions + (list (service-extension shepherd-root-service-type + tailon-shepherd-service) + (service-extension account-service-type + (const %tailon-accounts)))) + (compose concatenate) + (extend (lambda (parameter files) + (tailon-configuration + (inherit parameter) + (config-file + (let ((old-config-file + (tailon-configuration-config-file parameter))) + (tailon-configuration-file + (inherit old-config-file) + (files (append (tailon-configuration-file-files old-config-file) + files)))))))) + (default-value (tailon-configuration)))) + ;;; admin.scm ends here diff --git a/gnu/tests/admin.scm b/gnu/tests/admin.scm new file mode 100644 index 000000000..ef3ddf079 --- /dev/null +++ b/gnu/tests/admin.scm @@ -0,0 +1,128 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Christopher Baines +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu tests admin) + #:use-module (gnu tests) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system shadow) + #:use-module (gnu system vm) + #:use-module (gnu services) + #:use-module (gnu services admin) + #:use-module (gnu services networking) + #:use-module (guix gexp) + #:use-module (guix store) + #:use-module (guix monads) + #:export (%test-tailon)) + +(define %tailon-os + ;; Operating system under test. + (simple-operating-system + (dhcp-client-service) + (service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (bind "0.0.0.0:8080"))))))) + +(define* (run-tailon-test #:optional (http-port 8081)) + "Run tests in %TAILON-OS, which has tailon running and listening on +HTTP-PORT." + (define os + (marionette-operating-system + %tailon-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define vm + (virtual-machine + (operating-system os) + (port-forwardings `((,http-port . 8080))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-11) (srfi srfi-64) + (ice-9 match) + (gnu build marionette) + (web uri) + (web client) + (web response)) + + (define marionette + ;; Forward the guest's HTTP-PORT, where tailon is listening, to + ;; port 8080 in the host. + (make-marionette (list #$vm))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "tailon") + + (test-eq "service running" + 'running! + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'tailon) + 'running!) + marionette)) + + (define* (retry-on-error f #:key times delay) + (let loop ((attempt 1)) + (match (catch + #t + (lambda () + (cons #t + (f))) + (lambda args + (cons #f + args))) + ((#t . return-value) + return-value) + ((#f . error-args) + (if (>= attempt times) + error-args + (begin + (sleep delay) + (loop (+ 1 attempt)))))))) + + (test-equal "http-get" + 200 + (retry-on-error + (lambda () + (let-values (((response text) + (http-get #$(format + #f + "http://localhost:~A/" + http-port) + #:decode-body? #t))) + (response-code response))) + #:times 5 + #:delay 2)) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "tailon-test" test)) + +(define %test-tailon + (system-test + (name "tailon") + (description "Connect to a running Tailon server.") + (value (run-tailon-test)))) -- 2.13.3 From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 28 Jul 2017 19:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150127058521191 (code B ref 27650); Fri, 28 Jul 2017 19:37:02 +0000 Received: (at 27650) by debbugs.gnu.org; 28 Jul 2017 19:36:25 +0000 Received: from localhost ([127.0.0.1]:60299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbB3h-0005Vj-HD for submit@debbugs.gnu.org; Fri, 28 Jul 2017 15:36:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbB3e-0005VS-0j for 27650@debbugs.gnu.org; Fri, 28 Jul 2017 15:36:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbB3V-0000yh-4u for 27650@debbugs.gnu.org; Fri, 28 Jul 2017 15:36:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbB3V-0000yc-16; Fri, 28 Jul 2017 15:36:13 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:50470 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dbB3U-0002qR-De; Fri, 28 Jul 2017 15:36:12 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87379j7wpe.fsf@gnu.org> <20170727173506.23641-1-mail@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 Thermidor an 225 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Fri, 28 Jul 2017 21:36:10 +0200 In-Reply-To: <20170727173506.23641-1-mail@cbaines.net> (Christopher Baines's message of "Thu, 27 Jul 2017 18:35:06 +0100") Message-ID: <877eysmk0l.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > * gnu/services/admin.scm > (, ): New record types. > (tailon-configuration-files-string, tailon-shepherd-service): New > procedures. > (%tailon-accounts, tailon-service-type: New variables. > * doc/guix.texi (Monitoring Services: Document the Tailon service. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > * gnu/tests/admin.scm: New file. You also need to add gnu/tests/admin.scm to local.mk, but apart from that it looks perfect to me. Thank you! Ludo=E2=80=99. From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 28 Jul 2017 21:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.15012756314359 (code B ref 27650); Fri, 28 Jul 2017 21:01:02 +0000 Received: (at 27650) by debbugs.gnu.org; 28 Jul 2017 21:00:31 +0000 Received: from localhost ([127.0.0.1]:60403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbCN5-00018F-6a for submit@debbugs.gnu.org; Fri, 28 Jul 2017 17:00:31 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:60121 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbCMz-000183-Vp for 27650@debbugs.gnu.org; Fri, 28 Jul 2017 17:00:29 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 3F8B413E3A3; Fri, 28 Jul 2017 22:00:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dyn-81-5-135-42.dsl.eclipse.net.uk [81.5.135.42]) by mira.cbaines.net (Postfix) with ESMTPSA id 51F1213D1CE; Fri, 28 Jul 2017 22:00:23 +0100 (BST) Date: Fri, 28 Jul 2017 22:00:22 +0100 From: Christopher Baines Message-ID: <20170728220022.01ed8ee2@cbaines.net> In-Reply-To: <877eysmk0l.fsf@gnu.org> References: <87379j7wpe.fsf@gnu.org> <20170727173506.23641-1-mail@cbaines.net> <877eysmk0l.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/VS/7SzfdDQvQb2m0KtwdQ_b"; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Sig_/VS/7SzfdDQvQb2m0KtwdQ_b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 28 Jul 2017 21:36:10 +0200 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Christopher Baines skribis: >=20 > > * gnu/services/admin.scm > > (, ): New record > > types. (tailon-configuration-files-string, > > tailon-shepherd-service): New procedures. > > (%tailon-accounts, tailon-service-type: New variables. > > * doc/guix.texi (Monitoring Services: Document the Tailon service. > > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > > * gnu/tests/admin.scm: New file. =20 >=20 > You also need to add gnu/tests/admin.scm to local.mk, but apart from > that it looks perfect to me. Thank you! The latest patch I send should have included updating local.mk, at least the quoted changelog claims to change the file. I'll clarify what exactly was added, and look to push this, but do let me know if there is something that still needs doing. Thanks for your help and review, Chris --Sig_/VS/7SzfdDQvQb2m0KtwdQ_b Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAll7peZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XfskxAAuLVFjqb5o1YlWn5pew6PbXaVOroUpO8gfC30dY0buBuOHs9j1oMSYZ9P PnR8dQwJkfrinA1hSFGsOBPqdEh6n+jcs6hTIv0/vSNR/2g2rutHopd72cSA/pwg 2YfmpmQfQFMgmhICanpmZ7XzsueWorCF+UXGFG+kTaAd+k+2NpZJZYClHFxXsz9B eEnPKfIEwgVLYHtNd6xx/x+PMxrgk1ZrNxD0P7gzWQQWNFhDKHDE4+LuObaUeLgn 7kLl3CDdDhoIM/fhLPhS1NV9PpAn+t3A9f9sAx2R6obCen06RR37YIMhBfyr7OwW FwUmZkabPQ9hpA6uQhlYkB379tjGPp0mJLVjhMbpBknJBzK7iNe7EoznhLZHJcFp 8EjQ7Rai2WMEhzpB9h/4QNqXOcRfFRYNsV2KhpnihCvEAkEX4WsTnsK81xEq66P5 WF+Xm8Wb23p5CydbSVsZhOc+5VfE+RnLkef5rRJlAi9+rznIVaZfU0Haf+2h0oXL UgCbw3Cs5JHi7REUodl/5Xv6fopaMdIZ5ZzAbb9cIaztyuap1UU+2I1ZF4fzM70p jHFQiZ76iDlwVpgGdtUi5PjCLNeLyyrr43Dzb16h+DW59gzhrRL/npJ1kY7+D/RS PiJ81Lp9iOEipXv1oAcTSRuqF9aaosb1RW4U3qPf5IYGXGdKLBc= =+zPl -----END PGP SIGNATURE----- --Sig_/VS/7SzfdDQvQb2m0KtwdQ_b-- From unknown Mon Aug 18 17:53:47 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Christopher Baines Subject: bug#27650: closed (Re: [bug#27650] [PATCH] gnu: services: admin: Add tailon.) Message-ID: References: <20170729130053.7621cbb6@cbaines.net> <20170711065634.9717-1-mail@cbaines.net> X-Gnu-PR-Message: they-closed 27650 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 27650@debbugs.gnu.org Date: Sat, 29 Jul 2017 12:01:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1501329662-26301-1" This is a multi-part message in MIME format... ------------=_1501329662-26301-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #27650: [PATCH] gnu: services: admin: Add tailon. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 27650@debbugs.gnu.org. --=20 27650: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27650 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1501329662-26301-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 27650-done) by debbugs.gnu.org; 29 Jul 2017 12:00:59 +0000 Received: from localhost ([127.0.0.1]:60709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbQQV-0006ps-Ij for submit@debbugs.gnu.org; Sat, 29 Jul 2017 08:00:59 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:43131 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbQQR-0006pe-Pl for 27650-done@debbugs.gnu.org; Sat, 29 Jul 2017 08:00:58 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 5A9EC13E3A3; Sat, 29 Jul 2017 13:00:55 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (unknown [94.119.64.12]) by mira.cbaines.net (Postfix) with ESMTPSA id DDDD213D1CE for <27650-done@debbugs.gnu.org>; Sat, 29 Jul 2017 13:00:54 +0100 (BST) Date: Sat, 29 Jul 2017 13:00:53 +0100 From: Christopher Baines To: 27650-done@debbugs.gnu.org Subject: Re: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Message-ID: <20170729130053.7621cbb6@cbaines.net> In-Reply-To: <20170728220022.01ed8ee2@cbaines.net> References: <87379j7wpe.fsf@gnu.org> <20170727173506.23641-1-mail@cbaines.net> <877eysmk0l.fsf@gnu.org> <20170728220022.01ed8ee2@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/qD7jVqMErEI05ZKJTdxtKPV"; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 27650-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Sig_/qD7jVqMErEI05ZKJTdxtKPV Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 28 Jul 2017 22:00:22 +0100 Christopher Baines wrote: > On Fri, 28 Jul 2017 21:36:10 +0200 > ludo@gnu.org (Ludovic Court=C3=A8s) wrote: >=20 > > Christopher Baines skribis: > > =20 > > > * gnu/services/admin.scm > > > (, ): New > > > record types. (tailon-configuration-files-string, > > > tailon-shepherd-service): New procedures. > > > (%tailon-accounts, tailon-service-type: New variables. > > > * doc/guix.texi (Monitoring Services: Document the Tailon service. > > > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > > > * gnu/tests/admin.scm: New file. =20 > >=20 > > You also need to add gnu/tests/admin.scm to local.mk, but apart from > > that it looks perfect to me. Thank you! =20 >=20 > The latest patch I send should have included updating local.mk, at > least the quoted changelog claims to change the file. I'll clarify > what exactly was added, and look to push this, but do let me know if > there is something that still needs doing. Now pushed! --Sig_/qD7jVqMErEI05ZKJTdxtKPV Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAll8ePVfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XeiSg/+Oz+hMbMlLTdx9FfAk50Nm7HkktBHwdUIeO2Bt8Q6qGeTnI6eG612Bv0i dmGoopHxRthhjIsl3cUPWboI26C3mAmORz2qZu5IVLcjPOEoIcR1+fdUFkviiOfI vnSFXdnLIgwnWeYIXY618RaTsGwwqXlNiSen1BfdKe6qjTU8vZIhCKphlRful74a xzMOCeHFhGY2DQJfjCepkZXS3nM4fuiHtujO+ZQWtGf7FQx4clD0f0WMilM3VGxA DgwTZOBl9bWzni2yyv6qoi4qhXaPdDqlUuZ1QkWJdPTONHJnEGpVQoq8dZtd3tEd NCA/SCuj5/GV9rZRs6PJ0yMg1mpyhMAvGWlRamWhkk9kJenXVF4uxZgNCihNdY5E E8aMnjZR9AWXNjeK9w0FIsdjM2ZbqH8ee8acbiDstBAcA5hFlRjUaewfgX1oSgCm dMGgolCWJ2gzLGWkCsTwj113G9s2XfldnmLge63onQFLk+a3rtHQm9a2kdAmV1pc 7pVGpWzXpIkVJxi9W9f7ISX6Acw0NK01Iu6y76tUXjdmQdogz277VUWeP4oiHWko X8ruvvb9EAEtqm8hZ26cjKES683MGWFvRrOdT/73ApA7sssaHJOejVncAjMl7jI/ GkPZ4/2BM75iCv5zF8IqOd5Et1qU+NPcl77gTzp+KcD1MdLw+mE= =qwCN -----END PGP SIGNATURE----- --Sig_/qD7jVqMErEI05ZKJTdxtKPV-- ------------=_1501329662-26301-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Jul 2017 06:57:14 +0000 Received: from localhost ([127.0.0.1]:33288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUp6g-0006zv-EE for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUp6e-0006zi-Ci for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUp6X-0002vf-SV for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53675) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUp6X-0002vb-PQ for submit@debbugs.gnu.org; Tue, 11 Jul 2017 02:57:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUp6V-0003if-VF for guix-patches@gnu.org; Tue, 11 Jul 2017 02:57:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUp6S-0002v4-RA for guix-patches@gnu.org; Tue, 11 Jul 2017 02:57:04 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:47941 helo=mira.cbaines.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUp6S-0002qc-IZ for guix-patches@gnu.org; Tue, 11 Jul 2017 02:57:00 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id D1BD313D1D5; Tue, 11 Jul 2017 07:56:34 +0100 (BST) Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 7A4AB13D1D3 for ; Tue, 11 Jul 2017 07:56:34 +0100 (BST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 833a2c7e for ; Tue, 11 Jul 2017 06:56:34 +0000 (UTC) From: Christopher Baines To: guix-patches@gnu.org Subject: [PATCH] gnu: services: admin: Add tailon. Date: Tue, 11 Jul 2017 07:56:34 +0100 Message-Id: <20170711065634.9717-1-mail@cbaines.net> X-Mailer: git-send-email 2.13.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) * gnu/services/admin.scm (, ): New record types. (tailon-configuration-files-string, tailon-shepherd-service): New procedures. (%tailon-accounts, tailon-service-type: New variables. * doc/guix.text (Monitoring Services: Document the Tailon service. --- doc/guix.texi | 88 +++++++++++++++++++++++++++++ gnu/services/admin.scm | 150 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 237 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 729ec081b..164dccba1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -218,6 +218,7 @@ Services * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -8901,6 +8902,7 @@ declaration. * Database Services:: SQL databases. * Mail Services:: IMAP, POP3, SMTP, and all that. * Messaging Services:: Messaging services. +* Monitoring Services:: Monitoring services. * Kerberos Services:: Kerberos services. * Web Services:: Web servers. * DNS Services:: DNS daemons. @@ -13489,6 +13491,92 @@ string, you could instantiate a prosody service like this: (prosody.cfg.lua ""))) @end example +@node Monitoring Services +@subsubsection Monitoring Services + +@subsubheading Tailon Service + +Tailon is a web application for viewing and searching log files. + +The following example will configure the service with default values. +By default, Tailon can be accessed on port 8080 (http://localhost:8080). + +@example +(service tailon-service-type) +@end example + +The following example customises more of the Tailon configuration, +adding ``sed'' to the list of allowed commands. + +@example +(service tailon-service-type + (tailon-configuration + (config-file + (tailon-configuration-file + (allowed-commands '("tail" "grep" "awk" "sed")))))) +@end example + + +@deftp {Data Type} tailon-configuration +Data type representing the configuration of tailon. +This type has the following parameters: + +@table @asis +@item @code{config-file} (default: @code{(tailon-configuration-file)}) +The configuration file to use for Tailon. This can be set to a +@dfn{tailon-configuration-file} record value, or any gexp +(@pxref{G-Expressions}). + +For example, to instead use a local file, the @code{local-file} function +can be used: + +@example +(service tailon-service-type + (tailon-configuration + (config-file (local-file "./my-tailon.conf")))) +@end example + +@item @code{package} (default: @code{tailon}) +The tailon package to use. + +@end table +@end deftp + +@deftp {Data Type} tailon-configuration-file +Data type representing the configuration options for Tailon. +This type has the following parameters: + +@table @asis +@item @code{paths} (default: @code{(list "/var/log")}) +List of paths to display. Can include strings for a single path, or a +list, where the first item is the name of a subsection, and the +remaining items are in that subsection. + +@item @code{bind} (default: @code{"localhost:8080"}) +Address and port to which Tailon should bind on. + +@item @code{relative-root-path} (default: @code{#f}) +Prefix to use for all paths, set to @code{#f} to disable using a prefix. + +@item @code{allow-transfers?} (default: @code{#t}) +Allow downloading the log files in the web interface. + +@item @code{follow-names?} (default: @code{#t}) +Allow tailing of not-yet existent files. + +@item @code{tail-lines} (default: @code{200}) +Number of lines to read initially from each file. + +@item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")}) +Commands to allow running. By default, @code{sed} is disabled. + +@item @code{debug?} (default: @code{#f}) +Set @code{debug?} to @code{#t} to show debug messages. + +@end table +@end deftp + + @node Kerberos Services @subsubsection Kerberos Services @cindex Kerberos diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index b9e3fa70a..eb1f70ec6 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -20,14 +20,19 @@ (define-module (gnu services admin) #:use-module (gnu packages admin) #:use-module (gnu packages base) + #:use-module (gnu packages logging) #:use-module (gnu services) #:use-module (gnu services mcron) #:use-module (gnu services shepherd) + #:use-module (gnu services web) + #:use-module (gnu system shadow) #:use-module (guix gexp) + #:use-module (guix store) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 vlist) + #:use-module (ice-9 match) #:export (%default-rotations %rotated-files @@ -41,7 +46,27 @@ rottlog-configuration rottlog-configuration? rottlog-service - rottlog-service-type)) + rottlog-service-type + + + tailon-configuration-file + tailon-configuration-file? + tailon-configuration-file-paths + tailon-configuration-file-bind + tailon-configuration-file-relative-root-path + tailon-configuration-file-allow-transfers? + tailon-configuration-file-follow-names? + tailon-configuration-file-tail-lines + tailon-configuration-file-allowed-commands + tailon-configuration-file-debug? + + + tailon-configuration + tailon-configuration? + tailon-configuration-config-file + tailon-configuration-package + + tailon-service-type)) ;;; Commentary: ;;; @@ -172,4 +197,127 @@ for ROTATION." rotations))))) (default-value (rottlog-configuration)))) + +;;; +;;; Tailon +;;; + +(define-record-type* + tailon-configuration-file make-tailon-configuration-file + tailon-configuration-file? + (paths tailon-configuration-paths + (default '("/var/log"))) + (bind tailon-configuration-file-bind + (default "localhost:8080")) + (relative-root-path tailon-configuration-file-relative-root-path + (default #f)) + (allow-transfers? tailon-configuration-file-allow-transfers? + (default #t)) + (follow-names? tailon-configuration-file-follow-names? + (default #t)) + (tail-lines tailon-configuration-file-tail-lines + (default 200)) + (allowed-commands tailon-configuration-file-allowed-commands + (default '("tail" "grep" "awk"))) + (debug? tailon-configuration-file-debug? + (default #f))) + +(define (tailon-configuration-files-string paths) + (string-append + "\n" + (string-join + (map + (lambda (x) + (string-append + " - " + (cond + ((string? x) + (simple-format #f "'~A'" x)) + ((list? x) + (string-join + (cons (simple-format #f "'~A':" (car x)) + (map + (lambda (x) (simple-format #f " - '~A'" x)) + (cdr x))) + "\n")) + (else (error x))))) + paths) + "\n"))) + +(define-gexp-compiler (tailon-configuration-file-compiler + (file ) system target) + (match file + (($ paths bind relative-root-path + allow-transfers? follow-names? + tail-lines allowed-commands debug?) + (text-file + "tailon-config.yaml" + (string-concatenate + (filter-map + (match-lambda + ((key . #f) #f) + ((key . value) (string-append key ": " value "\n"))) + + `(("files" . ,(tailon-configuration-files-string paths)) + ("bind" . ,bind) + ("relative-root" . ,relative-root-path) + ("allow-transfers" . ,(if allow-transfers? "true" "false")) + ("follow-names" . ,(if follow-names? "true" "false")) + ("tail-lines" . ,(number->string tail-lines)) + ("commands" . ,(string-append "[" + (string-join allowed-commands ", ") + "]")) + ,@(if debug? '(("debug" . "true")) '())))))))) + +(define-record-type* + tailon-configuration make-tailon-configuration + tailon-configuration? + (config-file tailon-configuration-config-file + (default (tailon-configuration-file))) + (package tailon-configuration-package + (default tailon))) + +(define tailon-shepherd-service + (match-lambda + (($ config-file package) + (list (shepherd-service + (provision '(tailon)) + (documentation "Run the tailon daemon.") + (start #~(make-forkexec-constructor + `(,(string-append #$package "/bin/tailon") + "-c" ,#$config-file) + #:user "tailon" + #:group "tailon")) + (stop #~(make-kill-destructor))))))) + +(define %tailon-accounts + (list (user-group (name "tailon") (system? #t)) + (user-account + (name "tailon") + (group "tailon") + (system? #t) + (comment "tailon") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define tailon-service-type + (service-type + (name 'tailon) + (extensions + (list (service-extension shepherd-root-service-type + tailon-shepherd-service) + (service-extension account-service-type + (const %tailon-accounts)))) + (compose concatenate) + (extend (lambda (parameter paths) + (tailon-configuration + (inherit parameter) + (config-file + (let ((old-config-file (tailon-configuration-config-file parameter))) + (tailon-configuration-file + (inherit old-config-file) + (paths (append (tailon-configuration-paths old-config-file) + paths)))))))) + (default-value (tailon-configuration)))) + ;;; admin.scm ends here -- 2.13.1 ------------=_1501329662-26301-1-- From unknown Mon Aug 18 17:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#27650] [PATCH] gnu: services: admin: Add tailon. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 29 Jul 2017 12:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 27650@debbugs.gnu.org Received: via spool by 27650-submit@debbugs.gnu.org id=B27650.150133022627158 (code B ref 27650); Sat, 29 Jul 2017 12:11:02 +0000 Received: (at 27650) by debbugs.gnu.org; 29 Jul 2017 12:10:26 +0000 Received: from localhost ([127.0.0.1]:60724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbQZe-00073y-FI for submit@debbugs.gnu.org; Sat, 29 Jul 2017 08:10:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbQZa-00073j-71 for 27650@debbugs.gnu.org; Sat, 29 Jul 2017 08:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbQZR-0001fF-3I for 27650@debbugs.gnu.org; Sat, 29 Jul 2017 08:10:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbQZQ-0001f9-W2; Sat, 29 Jul 2017 08:10:13 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:53834 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dbQZQ-0000Zi-HJ; Sat, 29 Jul 2017 08:10:12 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87379j7wpe.fsf@gnu.org> <20170727173506.23641-1-mail@cbaines.net> <877eysmk0l.fsf@gnu.org> <20170728220022.01ed8ee2@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 11 Thermidor an 225 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Sat, 29 Jul 2017 14:10:10 +0200 In-Reply-To: <20170728220022.01ed8ee2@cbaines.net> (Christopher Baines's message of "Fri, 28 Jul 2017 22:00:22 +0100") Message-ID: <87vambigv1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Christopher Baines skribis: > On Fri, 28 Jul 2017 21:36:10 +0200 > ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > >> Christopher Baines skribis: >>=20 >> > * gnu/services/admin.scm >> > (, ): New record >> > types. (tailon-configuration-files-string, >> > tailon-shepherd-service): New procedures. >> > (%tailon-accounts, tailon-service-type: New variables. >> > * doc/guix.texi (Monitoring Services: Document the Tailon service. >> > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. >> > * gnu/tests/admin.scm: New file.=20=20 >>=20 >> You also need to add gnu/tests/admin.scm to local.mk, but apart from >> that it looks perfect to me. Thank you! > > The latest patch I send should have included updating local.mk, at > least the quoted changelog claims to change the file. I'll clarify what > exactly was added, and look to push this, but do let me know if there > is something that still needs doing. I guess we=E2=80=99re done now, thanks! Ludo=E2=80=99.