blob: 26de3ffdd5d2d91c038987e75c1d7355ffb3a37f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
|