Logrotate
services.logrotate.checkConfig
Whether the config should be checked at build time.
Some options are not checkable at build time because of the build sandbox:
for example, the test does not know about existing files and system users are
not known.
These limitations mean we must adjust the file for tests (missingok is forced
and users are replaced by dummy users), so tests are complemented by a
logrotate-checkconf service that is enabled by default.
This extra check can be disabled by disabling it at the systemd level with the
{option}systemd.services.logrotate-checkconf.enable
option.
Conversely there are still things that might make this check fail incorrectly (e.g. a file path where we don't have access to intermediate directories): in this case you can disable the failing check with this option.
Type: boolean
Default
true
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.configFile
Override the configuration file used by logrotate. By default, NixOS generates one automatically from .
Type: path
Default
'' A configuration file automatically generated by NixOS.''
Example
pkgs.writeText "logrotate.conf" '' missingok "/var/log/*.log" { rotate 4 weekly }'';
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.enable
Whether to enable the logrotate systemd service.
Type: boolean
Default
cfg.settings != {}
Example
true
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.extraArgs
Additional command line arguments to pass on logrotate invocation
Type: list of string
Default
[ ]
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.settings
logrotate freeform settings: each attribute here will define its own section,
ordered by {option}services.logrotate.settings.<name>.priority
,
which can either define files to rotate with their settings
or settings common to all further files settings.
All attribute names not explicitly defined as sub-options here are passed through
as logrotate config directives,
refer to https://linux.die.net/man/8/logrotate for details.
Type: attribute set of (attribute set of (null or signed integer or boolean or string))
Default
{ }
Example
{# global optionsheader = {dateext = true;};# example custom files"/var/log/mylog.log" = {frequency = "daily";rotate = 3;};"multiple paths" = {files = ["/var/log/first*.log""/var/log/second.log"];};# specify custom order of sections"/var/log/myservice/*.log" = {# ensure lower prioritypriority = 110;postrotate = '' systemctl reload myservice '';};};
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.settings.<name>.enable
Whether to enable setting individual kill switch.
Type: boolean
Default
true
Example
true
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.settings.<name>.files
Single or list of files for which rules are defined. The files are quoted with double-quotes in logrotate configuration, so globs and spaces are supported. Note this setting is ignored if globals is true.
Type: string or list of string
Default
'' The attrset name if not specified''
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.settings.<name>.frequency
How often to rotate the logs. Defaults to previously set global setting, which itself defaults to weekly.
Type: null or string
Default
null
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.settings.<name>.global
Whether this setting is a global option or not: set to have these settings apply to all files settings with a higher priority.
Type: boolean
Default
false
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix
services.logrotate.settings.<name>.priority
Order of this logrotate block in relation to the others. The semantics are
the same as with lib.mkOrder
. Smaller values are inserted first.
Type: signed integer
Default
1000
Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/logging/logrotate.nix