summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-04-06 11:47:04 +0200
committerLudovic Courtès <ludo@gnu.org>2020-04-06 12:07:49 +0200
commit0468455e7d279c89ea3ad1b51935efb2b785ec47 (patch)
tree7897b257201a5b651e50aaaeb0f3ae47fe2b9547
parent11dee1bb8fbe6efd85280ca58f3bd2f90baef31a (diff)
downloadguix-0468455e7d279c89ea3ad1b51935efb2b785ec47.tar.gz
services: Add 'rottlog-service-type' to '%base-services'.
* gnu/services/base.scm (%base-services): Add an instance of
ROTTLOG-SERVICE-TYPE.
* doc/guix.texi (Log Rotation): Mention that it's part of
%BASE-SERVICES and change example.
-rw-r--r--doc/guix.texi20
-rw-r--r--gnu/services/base.scm2
2 files changed, 17 insertions, 5 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 4d1acf1342..450ca3c5d8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13186,17 +13186,27 @@ 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, for commonly encountered log files.
+This service is part of @code{%base-services}, and thus enabled by
+default, with the default settings, for commonly encountered log files.
+The example below shows how to extend it with an additional
+@dfn{rotation}, should you need to do that (usually, services that
+produce log files already take care of that):
 
 @lisp
 (use-modules (guix) (gnu))
-(use-service-modules admin mcron)
-(use-package-modules base idutils)
+(use-service-modules admin)
+
+(define my-log-files
+  ;; Log files that I want to rotate.
+  '("/var/log/something.log" "/var/log/another.log"))
 
 (operating-system
   ;; @dots{}
-  (services (cons (service rottlog-service-type)
+  (services (cons (simple-service 'rotate-my-stuff
+                                  rottlog-service-type
+                                  (list (log-rotation
+                                         (frequency 'daily)
+                                         (files my-log-files))))
                   %base-services)))
 @end lisp
 
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 8d9a563e2b..a0179c0259 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2444,6 +2444,8 @@ to handle."
         (service guix-service-type)
         (service nscd-service-type)
 
+        (service rottlog-service-type)
+
         ;; The LVM2 rules are needed as soon as LVM2 or the device-mapper is
         ;; used, so enable them by default.  The FUSE and ALSA rules are
         ;; less critical, but handy.