[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Shepherd log rotation service
From: |
Ludovic Courtès |
Subject: |
Shepherd log rotation service |
Date: |
Sat, 18 May 2024 23:11:40 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello Guix!
I’ve just pushed a simple log rotation service for Shepherd:
https://git.savannah.gnu.org/cgit/shepherd.git/commit/?h=devel&id=0484726801c2b5c1b7deecb9a96054c2c510ac71
It rotates log files roughly the same way we’ve been doing since the
70’s, but there’s a couple of advantages compared to what we’re
currently doing in Guix System:
• No need to repeat the name of log files since shepherd already knows
them via #:log-file (that’s another reason to avoid
non-shepherd-managed log files).
• Rotation is race-free: it’s impossible to lose a line of log while
the file is being rotated. This is guaranteed by the “logger”,
which offers a method to atomically close its log file, rename it,
and open a new empty log file.
• The log rotation service is a timer so one can inspect it with ‘herd
status log-rotation’, trigger it with ‘herd trigger log-rotation’,
and so on.
At this point the log file of shepherd itself, for instance
/var/log/messages, is not handled; this will have to be fixed.
There aren’t many options to specify how to rotate logs (very few
compared to rottlog!), but I figured we’d rather have something simple
that works well and without surprises; we can always add knobs later if
necessary.
Feedback welcome!
Ludo’.
- Shepherd log rotation service,
Ludovic Courtès <=