MyNixOS website logo
option

services.logrotate.settings

logrotate freeform settings: each attribute here will define its own section, ordered by 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.

Declarations
Type
attribute set of (attribute set of (null or signed integer or boolean or string))
Default
{ }
Example
{
  # global options
  header = {
    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 priority
    priority = 110;
    postrotate = ''
      systemctl reload myservice
    '';
  };
};