2009-09-25 20:55:08 +01:00
|
|
|
{ config, pkgs, ... }:
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
with pkgs.lib;
|
2009-03-06 12:25:57 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
syslogConf = pkgs.writeText "syslog.conf" ''
|
2009-09-25 20:55:08 +01:00
|
|
|
kern.warning;*.err;authpriv.none /dev/${config.services.syslogd.tty}
|
2008-05-08 14:47:44 +01:00
|
|
|
|
|
|
|
# Send emergency messages to all users.
|
|
|
|
*.emerg *
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2008-05-08 13:27:01 +01:00
|
|
|
# "local1" is used for dhcpd messages.
|
|
|
|
local1.* -/var/log/dhcpd
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2008-05-08 13:27:01 +01:00
|
|
|
mail.* -/var/log/mail
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2008-05-08 13:27:01 +01:00
|
|
|
*.=warning;*.=err -/var/log/warn
|
|
|
|
*.crit /var/log/warn
|
|
|
|
|
|
|
|
*.*;mail.none;local1.none -/var/log/messages
|
2010-03-09 13:31:20 +00:00
|
|
|
|
|
|
|
${config.services.syslogd.extraConfig}
|
2008-04-01 13:50:47 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
2006-11-19 20:07:45 +00:00
|
|
|
|
2006-11-19 21:03:22 +00:00
|
|
|
{
|
2009-09-25 20:55:08 +01:00
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.syslogd = {
|
|
|
|
|
|
|
|
tty = mkOption {
|
|
|
|
default = "tty10";
|
|
|
|
description = ''
|
|
|
|
The tty device on which syslogd will print important log
|
|
|
|
messages.
|
2009-03-06 12:25:57 +00:00
|
|
|
'';
|
2009-09-25 20:55:08 +01:00
|
|
|
};
|
2010-03-09 13:31:20 +00:00
|
|
|
|
|
|
|
extraConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "news.* -/var/log/news";
|
|
|
|
description = ''
|
|
|
|
Additional text appended to <filename>syslog.conf</filename>.
|
|
|
|
'';
|
|
|
|
};
|
2009-09-25 20:55:08 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs.syslogd =
|
2009-10-12 18:27:57 +01:00
|
|
|
{ description = "Syslog daemon";
|
2009-09-25 20:55:08 +01:00
|
|
|
|
2009-11-06 15:46:56 +00:00
|
|
|
startOn = "started udev";
|
2009-09-25 20:55:08 +01:00
|
|
|
|
|
|
|
environment = { TZ = config.time.timeZone; };
|
|
|
|
|
2009-11-06 15:46:56 +00:00
|
|
|
daemonType = "fork";
|
|
|
|
|
|
|
|
exec = "${pkgs.sysklogd}/sbin/syslogd -f ${syslogConf}";
|
2009-09-25 20:55:08 +01:00
|
|
|
};
|
|
|
|
|
2009-03-06 12:25:57 +00:00
|
|
|
};
|
2009-09-25 20:55:08 +01:00
|
|
|
|
2006-11-19 20:07:45 +00:00
|
|
|
}
|