router/metrics: denoise kea logs

This commit is contained in:
chayleaf 2023-08-13 18:08:34 +07:00
parent 4f650b2091
commit ea1d12da4f

View file

@ -1,5 +1,6 @@
{ config { config
, router-lib , router-lib
, lib
, ... }: , ... }:
let let
cfg = config.router-settings; cfg = config.router-settings;
@ -25,20 +26,59 @@ in {
kea = { kea = {
enable = true; enable = true;
controlSocketPaths = [ controlSocketPaths = [
"/run/kea/kea-dhcp4-ctrl.sock" config.router.interfaces.br0.ipv4.kea.settings.control-socket.socket-name
"/run/kea/kea-dhcp6-ctrl.sock" config.router.interfaces.br0.ipv6.kea.settings.control-socket.socket-name
]; ];
listenAddress = netAddresses.lan4; listenAddress = netAddresses.lan4;
}; };
}; };
router.interfaces.br0 = { router.interfaces.br0 = let
ipv4.kea.settings.control-socket = { # all of this just to avoid logging commands...
socket-name = "/run/kea/kea-dhcp4-ctrl.sock"; keaLogs = v: [
socket-type = "unix"; "alloc-engine"
"auth"
"bad-packets"
"database"
"ddns"
"dhcp${toString v}"
"dhcpsrv"
"eval"
"hosts"
"leases"
"options"
"packets"
"tcp"
];
in {
ipv4.kea.settings = {
control-socket = {
socket-name = "/run/kea/kea-dhcp4-ctrl.sock";
socket-type = "unix";
};
loggers = lib.toList {
name = "kea-dhcp4";
severity = "WARN";
output_options = [ { output = "syslog"; } ];
} ++ map (name: {
name = "kea-dhcp4.${name}";
severity = "INFO";
output_options = [ { output = "syslog"; } ];
}) (keaLogs 4);
}; };
ipv6.kea.settings.control-socket = { ipv6.kea.settings = {
socket-name = "/run/kea/kea-dhcp6-ctrl.sock"; control-socket = {
socket-type = "unix"; socket-name = "/run/kea/kea-dhcp6-ctrl.sock";
socket-type = "unix";
};
loggers = lib.toList {
name = "kea-dhcp6";
severity = "WARN";
output_options = [ { output = "syslog"; } ];
} ++ map (name: {
name = "kea-dhcp6.${name}";
severity = "INFO";
output_options = [ { output = "syslog"; } ];
}) (keaLogs 6);
}; };
ipv6.corerad.settings.debug = { ipv6.corerad.settings.debug = {
address = "${netAddresses.lan4}:9430"; address = "${netAddresses.lan4}:9430";