feat(ulogd): enabling ulogd
All checks were successful
build configuration / build_web02 (push) Successful in 1m47s
build configuration / build_storage01 (push) Successful in 1m50s
build configuration / build_compute01 (push) Successful in 1m56s
build configuration / build_vault01 (push) Successful in 2m0s
build configuration / build_web01 (push) Successful in 2m25s
lint / check (push) Successful in 39s
build configuration / build_geo02 (push) Successful in 1m26s
build configuration / build_geo01 (push) Successful in 1m30s
build configuration / build_rescue01 (push) Successful in 1m35s
build configuration / build_bridge01 (push) Successful in 1m28s
build configuration / push_to_cache_web02 (push) Successful in 1m33s
build configuration / push_to_cache_storage01 (push) Successful in 1m30s
build configuration / push_to_cache_geo01 (push) Successful in 1m43s
build configuration / push_to_cache_geo02 (push) Successful in 1m47s
build configuration / push_to_cache_compute01 (push) Successful in 2m18s
build configuration / push_to_cache_rescue01 (push) Successful in 1m46s
build configuration / push_to_cache_bridge01 (push) Successful in 1m36s
build configuration / push_to_cache_web01 (push) Successful in 2m26s

This commit is contained in:
catvayor 2024-08-28 19:01:27 +02:00 committed by Ryan Lahfa
parent b8601b0782
commit 3b766e6a2b
2 changed files with 57 additions and 0 deletions

View file

@ -10,6 +10,7 @@ lib.extra.mkConfig {
"k-radius"
"networking"
"ups"
"ulogd"
];
extraConfig = {

View file

@ -0,0 +1,56 @@
{
config,
lib,
pkgs,
...
}:
{
services = {
ulogd = {
enable = true;
logLevel = 5;
settings = {
global = {
logfile = "/var/log/ulogd.log";
stack = [ "ct1:NFCT,ip2str1:IP2STR,pgsql1:PGSQL" ];
};
ct1 = { };
pgsql1 = {
db = "ulogd";
user = "ulogd";
table = "ulog2_ct";
procedure = "INSERT_CT";
};
};
};
postgresql = {
enable = true;
identMap = ''
ulogd-map root ulogd
'';
authentication = ''
local ulogd ulogd peer map=ulogd-map
'';
ensureUsers = [
{
name = "ulogd";
ensureDBOwnership = true;
}
];
ensureDatabases = [ "ulogd" ];
};
};
systemd.services.ulogd = {
serviceConfig.StateDirectory = "ulogd";
requires = [ "postgresql.service" ];
after = [ "postgresql.service" ];
path = [ config.services.postgresql.package ];
preStart = lib.mkAfter ''
if ! test -e "/var/lib/ulogd/.initialized"; then
psql -f "${pkgs.ulogd.doc}/share/doc/ulogd-pgsql/pgsql-ulogd2.sql" -d ulogd -U ulogd
touch "/var/lib/ulogd/.initialized"
fi
'';
};
}