logrotate: move wtmp/btmp rules to systemd
wtmp and btmp are created by systemd, so the rules are more appropriate there. They can be disabled explicitly with something like services.ogrotate.paths = { "/var/log/btmp".enable = false; "/var/log/wtmp".enable = false; }; if required.
This commit is contained in:
parent
4521b84d49
commit
9917af7fe0
@ -4,7 +4,6 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.logrotate;
|
||||
inherit (config.users) groups;
|
||||
|
||||
pathOpts = { name, ... }: {
|
||||
options = {
|
||||
@ -163,25 +162,6 @@ 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" ];
|
||||
|
@ -1212,6 +1212,23 @@ in
|
||||
boot.kernel.sysctl."kernel.pid_max" = mkIf pkgs.stdenv.is64bit (lib.mkDefault 4194304);
|
||||
|
||||
boot.kernelParams = optional (!cfg.enableUnifiedCgroupHierarchy) "systemd.unified_cgroup_hierarchy=0";
|
||||
|
||||
services.logrotate.paths = {
|
||||
"/var/log/btmp" = mapAttrs (_: mkDefault) {
|
||||
frequency = "monthly";
|
||||
keep = 1;
|
||||
extraConfig = ''
|
||||
create 0660 root ${config.users.groups.utmp.name}
|
||||
'';
|
||||
};
|
||||
"/var/log/wtmp" = mapAttrs (_: mkDefault) {
|
||||
frequency = "monthly";
|
||||
keep = 1;
|
||||
extraConfig = ''
|
||||
create 0664 root ${config.users.groups.utmp.name}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# FIXME: Remove these eventually.
|
||||
|
Loading…
Reference in New Issue
Block a user