From 694bef76b9b44c065eaecbb1bfae27d78e580b55 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 7 Apr 2024 00:16:41 +0200 Subject: [PATCH] nixos/logrotate docs: clarify settings I found the description text of the freeform settings a bit unclear regarding the priority and ordering of sections: It was not immediately clear to me that the `priority` was a NixOS module-level sub option instead of a logrotate-native configuration directive. To clarify this, I extend the examples and higlight `priority` as a module option. --- nixos/modules/services/logging/logrotate.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix index ba1445f08397..49cca0cb8112 100644 --- a/nixos/modules/services/logging/logrotate.nix +++ b/nixos/modules/services/logging/logrotate.nix @@ -104,9 +104,12 @@ in default = { }; description = lib.mdDoc '' logrotate freeform settings: each attribute here will define its own section, - ordered by priority, which can either define files to rotate with their settings + ordered by {option}`services.logrotate.settings..priority`, + which can either define files to rotate with their settings or settings common to all further files settings. - Refer to for details. + All attribute names not explicitly defined as sub-options here are passed through + as logrotate config directives, + refer to for details. ''; example = literalExpression '' { @@ -125,6 +128,14 @@ in "/var/log/second.log" ]; }; + # specify custom order of sections + "/var/log/myservice/*.log" = { + # ensure lower priority + priority = 110; + postrotate = ''' + systemctl reload myservice + '''; + }; }; ''; type = types.attrsOf (types.submodule ({ name, ... }: {