From 92c03a871559590f7f3b0640e3a6cfd83c8044e6 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 8 Sep 2016 01:20:43 +0200 Subject: services: Add rottlog. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/admin.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * doc/guix.texi (Log Rotation): New node. Co-authored-by: Ludovic Courtès --- doc/guix.texi | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index f5bbb92c7c..b670823753 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -26,7 +26,8 @@ Copyright @copyright{} 2016 Ben Woodcroft@* Copyright @copyright{} 2016 Chris Marusich@* Copyright @copyright{} 2016 Efraim Flashner@* Copyright @copyright{} 2016 John Darrington@* -Copyright @copyright{} 2016 ng0 +Copyright @copyright{} 2016 ng0@* +Copyright @copyright{} 2016 Jan Nieuwenhuizen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -213,6 +214,7 @@ Services * Base Services:: Essential system services. * Scheduled Job Execution:: The mcron service. +* Log Rotation:: The rottlog service. * Networking Services:: Network setup, SSH daemon, etc. * X Window:: Graphical display. * Desktop Services:: D-Bus and desktop services. @@ -7581,6 +7583,7 @@ declaration. @menu * Base Services:: Essential system services. * Scheduled Job Execution:: The mcron service. +* Log Rotation:: The rottlog service. * Networking Services:: Network setup, SSH daemon, etc. * X Window:: Graphical display. * Desktop Services:: D-Bus and desktop services. @@ -8055,6 +8058,85 @@ specifications,, mcron, GNU@tie{}mcron}). @end deftp +@node Log Rotation +@subsubsection Log Rotation + +@cindex rottlog +@cindex log rotation +Log files such as those found in @file{/var/log} tend to grow endlessly, +so it's a good idea to @dfn{rotate} them once in a while---i.e., archive +their contents in separate files, possibly compressed. The @code{(gnu +services admin)} module provides an interface to GNU@tie{}Rot[t]log, a +log rotation tool (@pxref{Top,,, rottlog, GNU Rot[t]log Manual}). + +The example below defines an operating system that provides log rotation +with the default settings. + +@lisp +(use-modules (guix) (gnu)) +(use-service-modules admin mcron) +(use-package-modules base idutils) + +(operating-system + ;; @dots{} + (services (cons* (mcron-service) + (service rottlog-service-type (rottlog-configuration)) + %base-services))) +@end lisp + +@defvr {Scheme Variable} rottlog-service-type +This is the type of the Rottlog service, whose value is a +@code{rottlog-configuration} object. + +This service type can define mcron jobs (@pxref{Scheduled Job +Execution}) to run the rottlog service. +@end defvr + +@deftp {Data Type} rottlog-configuration +Data type representing the configuration of rottlog. + +@table @asis +@item @code{rottlog} (default: @code{rottlog}) +The Rottlog package to use. + +@item @code{rc-file} (default: @code{(file-append rottlog "/etc/rc")}) +The Rottlog configuration file to use (@pxref{Mandatory RC Variables,,, +rottlog, GNU Rot[t]log Manual}). + +@item @code{periodic-rotations} (default: @code{`(("weekly" %default-rotatations))}) +A list of Rottlog period-name/period-config tuples. + +For example, taking an example from the Rottlog manual (@pxref{Period +Related File Examples,,, rottlog, GNU Rot[t]log Manual}), a valid tuple +might be: + +@example +("daily" ,(plain-file "daily" + "\ + /var/log/apache/* @{ + storedir apache-archives + rotate 6 + notifempty + nocompress + @}")) +@end example + +@item @code{jobs} +This is a list of gexps where each gexp corresponds to an mcron job +specification (@pxref{Scheduled Job Execution}). +@end table +@end deftp + +@defvr {Scheme Variable} %default-rotations +Specifies weekly rotation of @var{%rotated-files} and +@code{"/var/log/shepherd.log"}. +@end defvr + +@defvr {Scheme Variable} %rotated-files +The list of syslog-controlled files to be rotated. By default it is: +@code{'("/var/log/messages" "/var/log/secure")}. +@end defvr + @node Networking Services @subsubsection Networking Services -- cgit v1.2.3