Enable klogd on Linux < 3.5

On Linux >= 3.5, systemd takes care of logging kernel messages.
This commit is contained in:
Eelco Dolstra 2012-10-05 13:44:15 -04:00
parent a5969634f4
commit dd1770bf0b
2 changed files with 34 additions and 11 deletions

View file

@ -77,7 +77,7 @@
./services/hardware/udev.nix
./services/hardware/udisks.nix
./services/hardware/upower.nix
#./services/logging/klogd.nix
./services/logging/klogd.nix
./services/logging/logcheck.nix
./services/logging/logrotate.nix
./services/logging/logstash.nix

View file

@ -1,19 +1,42 @@
{ config, pkgs, ... }:
###### implementation
with pkgs.lib;
{
###### interface
jobs.klogd =
{ description = "Kernel log daemon";
options = {
startOn = "started syslogd";
path = [ pkgs.sysklogd ];
exec =
"klogd -c 1 -2 -n " +
"-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
services.klogd.enable = mkOption {
type = types.bool;
default = versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5";
description = ''
Whether to enable klogd, the kernel log message processing
daemon. Since systemd handles logging of kernel messages on
Linux 3.5 and later, this is only useful if you're running an
older kernel.
'';
};
};
###### implementation
config = mkIf config.services.klogd.enable {
jobs.klogd =
{ description = "Kernel Log Daemon";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.sysklogd ];
exec =
"klogd -c 1 -2 -n " +
"-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
};
};
}