From bf0c5dc70bbdce958086773783841370d3763dea Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Fri, 8 Dec 2023 12:35:41 +0800 Subject: [PATCH] services: tailscale: Rotate logs. * rosenthal/services/networking.scm (tailscale-log-rotations): New procedure. (tailscale-service-type): Extend rottlog-service-type with it. --- rosenthal/services/networking.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rosenthal/services/networking.scm b/rosenthal/services/networking.scm index ce47423..6d81355 100644 --- a/rosenthal/services/networking.scm +++ b/rosenthal/services/networking.scm @@ -9,6 +9,7 @@ #:use-module (gnu packages linux) #:use-module (gnu packages networking) #:use-module (gnu services) + #:use-module (gnu services admin) #:use-module (gnu services configuration) #:use-module (gnu services dbus) #:use-module (gnu services shepherd) @@ -401,7 +402,7 @@ list, power save will be disabled.")) "The iptables package to use.") (log-file - (string "/dev/null") + (string "/var/log/tailscaled.log") "Path to log file.") (bird-socket @@ -457,6 +458,10 @@ to #f.") "Log verbosity level; 0 is default, 1 or higher are increasingly verbose.") (no-serialization)) +(define (tailscale-log-rotations config) + (list (log-rotation + (files (list (tailscale-configuration-log-file config)))))) + (define tailscale-shepherd-service (match-record-lambda (tailscale iptables log-file bird-socket debug-server port socket @@ -506,6 +511,8 @@ to #f.") (list (service-extension shepherd-root-service-type tailscale-shepherd-service) (service-extension profile-service-type - (compose list tailscale-configuration-tailscale)))) + (compose list tailscale-configuration-tailscale)) + (service-extension rottlog-service-type + tailscale-log-rotations))) (default-value (tailscale-configuration)) (description "Run tailscaled.")))