diff options
author | Julien Moutinho <julm+nixpkgs@sourcephile.fr> | 2021-12-28 21:29:53 +0100 |
---|---|---|
committer | Julien Moutinho <julm+nixpkgs@sourcephile.fr> | 2021-12-29 02:07:02 +0100 |
commit | f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e (patch) | |
tree | 4e8d9635848cfe5ae355addcb4a1b228cc217e8b /nixos/modules/services/logging | |
parent | c2fd94a61cbcf7133dc3e6f8d915c172062865c2 (diff) | |
download | nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.tar nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.tar.gz nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.tar.bz2 nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.tar.lz nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.tar.xz nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.tar.zst nixpkgs-f7ff512d6dddfbbb9f02bc35cb2d1ef21137798e.zip |
nixos/logrotate: rotate login/logout logs by default
Diffstat (limited to 'nixos/modules/services/logging')
-rw-r--r-- | nixos/modules/services/logging/logrotate.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix index 3467cdf5abf..8cef4e8c083 100644 --- a/nixos/modules/services/logging/logrotate.nix +++ b/nixos/modules/services/logging/logrotate.nix @@ -4,6 +4,7 @@ with lib; let cfg = config.services.logrotate; + inherit (config.users) groups; pathOpts = { name, ... }: { options = { @@ -23,6 +24,8 @@ let path = mkOption { type = with types; either str (listOf str); + default = name; + defaultText = "attribute name"; description = '' The path to log files to be rotated. Spaces are allowed and normal shell quoting rules apply, @@ -160,6 +163,25 @@ in } ) cfg.paths; + services.logrotate = { + paths = { + "/var/log/btmp" = { + frequency = mkDefault "monthly"; + keep = mkDefault 1; + extraConfig = '' + create 0660 root ${groups.utmp.name} + ''; + }; + "/var/log/wtmp" = { + frequency = mkDefault "monthly"; + keep = mkDefault 1; + extraConfig = '' + create 0664 root ${groups.utmp.name} + ''; + }; + }; + }; + systemd.services.logrotate = { description = "Logrotate Service"; wantedBy = [ "multi-user.target" ]; |