nixos/rsyslogd & nixos/syslog-ng: fix broken module (#47306)
* journald: forward message to syslog by default if a syslog implementation is installed * added a test to ensure rsyslog is receiving messages when expected * added rsyslogd tests to release.nix
This commit is contained in:
parent
d6a15b09c7
commit
1381019e49
|
@ -587,6 +587,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.journald.forwardToSyslog = mkOption {
|
||||||
|
default = config.services.rsyslogd.enable || config.services.syslog-ng.enable;
|
||||||
|
defaultText = "config.services.rsyslogd.enable || config.services.syslog-ng.enable";
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to forward log messages to syslog.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
services.logind.extraConfig = mkOption {
|
services.logind.extraConfig = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
|
@ -754,6 +763,9 @@ in
|
||||||
ForwardToConsole=yes
|
ForwardToConsole=yes
|
||||||
TTYPath=${config.services.journald.console}
|
TTYPath=${config.services.journald.console}
|
||||||
''}
|
''}
|
||||||
|
${optionalString (config.services.journald.forwardToSyslog) ''
|
||||||
|
ForwardToSyslog=yes
|
||||||
|
''}
|
||||||
${config.services.journald.extraConfig}
|
${config.services.journald.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -399,6 +399,7 @@ in rec {
|
||||||
tests.radicale = callTest tests/radicale.nix {};
|
tests.radicale = callTest tests/radicale.nix {};
|
||||||
tests.redmine = callTest tests/redmine.nix {};
|
tests.redmine = callTest tests/redmine.nix {};
|
||||||
tests.rspamd = callSubTests tests/rspamd.nix {};
|
tests.rspamd = callSubTests tests/rspamd.nix {};
|
||||||
|
tests.rsyslogd = callSubTests tests/rsyslogd.nix {};
|
||||||
tests.runInMachine = callTest tests/run-in-machine.nix {};
|
tests.runInMachine = callTest tests/run-in-machine.nix {};
|
||||||
tests.rxe = callTest tests/rxe.nix {};
|
tests.rxe = callTest tests/rxe.nix {};
|
||||||
tests.samba = callTest tests/samba.nix {};
|
tests.samba = callTest tests/samba.nix {};
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
{ system ? builtins.currentSystem }:
|
||||||
|
|
||||||
|
with import ../lib/testing.nix { inherit system; };
|
||||||
|
{
|
||||||
|
test1 = makeTest {
|
||||||
|
name = "rsyslogd-test1";
|
||||||
|
meta.maintainers = [ lib.maintainers.aanderse ];
|
||||||
|
|
||||||
|
machine =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{ services.rsyslogd.enable = true;
|
||||||
|
services.journald.forwardToSyslog = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# ensure rsyslogd isn't receiving messages from journald if explicitly disabled
|
||||||
|
testScript = ''
|
||||||
|
$machine->waitForUnit("default.target");
|
||||||
|
$machine->fail("test -f /var/log/messages");
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
test2 = makeTest {
|
||||||
|
name = "rsyslogd-test2";
|
||||||
|
meta.maintainers = [ lib.maintainers.aanderse ];
|
||||||
|
|
||||||
|
machine =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{ services.rsyslogd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# ensure rsyslogd is receiving messages from journald
|
||||||
|
testScript = ''
|
||||||
|
$machine->waitForUnit("default.target");
|
||||||
|
$machine->succeed("test -f /var/log/messages");
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue