diff options
author | makefu <github@syntax-fehler.de> | 2016-07-11 20:45:16 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-07-11 20:45:16 +0200 |
commit | b9c2dc13d376a79bceef0829e3990544f950215d (patch) | |
tree | 1e82851719cf1a3fc49dabc5c6eb0b23a5f1d13f /makefu/3modules/forward-journal.nix | |
parent | 393f5cb5c71d91493be05f624796f1b19bac8e58 (diff) |
m 1 darth: configure with forward-journal, share
Diffstat (limited to 'makefu/3modules/forward-journal.nix')
-rw-r--r-- | makefu/3modules/forward-journal.nix | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/makefu/3modules/forward-journal.nix b/makefu/3modules/forward-journal.nix new file mode 100644 index 000000000..26de3ffdd --- /dev/null +++ b/makefu/3modules/forward-journal.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +with config.krebs.lib; +let + cfg = config.makefu.forward-journal; + + out = { + options.makefu.forward-journal = api; + config = lib.mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "forward journal via syslog"; + src = mkOption { + type = types.str; + description = "syslog host identifier"; + default = config.networking.hostName; + }; + dst = mkOption { + type = types.str; + description = "syslog host identifier"; + default = ""; + }; + proto = mkOption { + type = types.str; + default = "udp"; + }; + port = mkOption { + type = types.int; + description = "destination port"; + default = 514; + }; + + }; + + imp = { + services.syslog-ng = { + enable = true; + extraConfig = '' + template t_remote { template("<$PRI>$DATE ${cfg.src} $PROGRAM[$PID]: $MSG\n"); }; + source s_all { system(); internal(); }; + destination d_loghost { udp("${cfg.dst}" port(${toString cfg.port}) template(t_remote)); }; + log { source(s_all); destination(d_loghost); }; + ''; + }; + }; + +in +out + |