diff options
author | lassulus <lass@aidsballs.de> | 2016-07-14 22:59:13 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2016-07-14 22:59:13 +0200 |
commit | e2e532c88017f3e8a49a1dfeeef56b932465be31 (patch) | |
tree | 1bd4d3b83f81c8e74afc10e1e149a961bfd0484d /makefu/3modules/forward-journal.nix | |
parent | 38a50ffaeb10812eaa9530d8df0381f2d13e360c (diff) | |
parent | 14242c68f234f6de0bed015817ac206f99dc4f20 (diff) |
Merge remote-tracking branch 'gum/master'
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 + |