more caddy log tweaks

This commit is contained in:
Noah Masur 2024-08-21 01:23:08 +00:00
parent 9c4438bed2
commit 1cb5d3138c
No known key found for this signature in database

View File

@ -61,7 +61,7 @@
services.caddy = services.caddy =
let let
default_logger_name = "other"; default_logger_name = "other";
roll_size_mb = 10; roll_size_mb = 25;
# Extract list of hostnames (fqdns) from current caddy routes # Extract list of hostnames (fqdns) from current caddy routes
getHostnameFromMatch = match: if (lib.hasAttr "host" match) then match.host else [ ]; getHostnameFromMatch = match: if (lib.hasAttr "host" match) then match.host else [ ];
getHostnameFromRoute = getHostnameFromRoute =
@ -112,7 +112,9 @@
writer = { writer = {
output = "stderr"; output = "stderr";
}; };
exclude = map (hostname: "http.log.access.${hostname}") (builtins.attrNames hostname_map); exclude = (map (hostname: "http.log.access.${hostname}") (builtins.attrNames hostname_map)) ++ [
"http.log.access.${default_logger_name}"
];
}; };
# This is for the default access logs (anything not captured by hostname) # This is for the default access logs (anything not captured by hostname)
other = { other = {
@ -136,12 +138,24 @@
roll = true; roll = true;
inherit roll_size_mb; inherit roll_size_mb;
}; };
include = [ "admin.api" ]; include = [ "admin" ];
};
# This is for TLS cert management tracking
tls = {
level = "INFO";
encoder.format = "json";
writer = {
output = "file";
filename = "${config.services.caddy.logDir}/tls.log";
roll = true;
inherit roll_size_mb;
};
include = [ "tls" ];
}; };
# This is for debugging # This is for debugging
debug = { debug = {
level = "DEBUG"; level = "DEBUG";
encoder.format = "console"; encoder.format = "json";
writer = { writer = {
output = "file"; output = "file";
filename = "${config.services.caddy.logDir}/debug.log"; filename = "${config.services.caddy.logDir}/debug.log";