Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsyslogd & syslog-nd: fix broken module #47306

Merged
merged 6 commits into from Oct 27, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions nixos/modules/system/boot/systemd.nix
Expand Up @@ -587,6 +587,14 @@ in
'';
};

services.journald.forwardToSyslog = mkOption {
default = (if config.services.rsyslogd.enable || config.services.syslog-ng.enable then true else false);
aanderse marked this conversation as resolved.
Show resolved Hide resolved
type = types.bool;
description = ''
Whether to forward log messages to syslog.
'';
};

services.logind.extraConfig = mkOption {
default = "";
type = types.lines;
Expand Down Expand Up @@ -753,6 +761,9 @@ in
ForwardToConsole=yes
TTYPath=${config.services.journald.console}
''}
${optionalString (config.services.journald.forwardToSyslog) ''
ForwardToSyslog=yes
''}
${config.services.journald.extraConfig}
'';

Expand Down
27 changes: 27 additions & 0 deletions nixos/tests/rsyslogd.nix
@@ -0,0 +1,27 @@
import ./make-test.nix ({ pkgs, lib, ... }:
aanderse marked this conversation as resolved.
Show resolved Hide resolved
{
name = "rsyslogd";
meta.maintainers = [ lib.maintainers.aanderse ];

nodes = {
machine1 =
{ config, pkgs, ... }:
{ services.rsyslogd.enable = true;
services.journald.forwardToSyslog = false;
};

machine2 =
{ config, pkgs, ... }:
{ services.rsyslogd.enable = true;
};
aanderse marked this conversation as resolved.
Show resolved Hide resolved
};

# ensure rsyslogd is receiving messages from journald if and only if setup to do so
testScript = ''
$machine1->waitForUnit("default.target");
$machine1->fail("test -f /var/log/messages");

$machine2->waitForUnit("default.target");
$machine2->succeed("test -f /var/log/messages");
'';
})