fix: Prometheus logging is broken.

We'll need to fix it later.
This commit is contained in:
Jeremy Wall 2024-05-31 22:28:54 -04:00
parent ae3bead25a
commit e2a85065c3

View File

@ -18,6 +18,11 @@ with lib;
default = "localhost:9001"; default = "localhost:9001";
defaultText = "localhost:9001"; defaultText = "localhost:9001";
}; };
logsPath = mkOption rec {
description = "Path to save heracles log files to";
default = "/Users/zaphar/opt/heracles";
defaultText = default;
};
settings = mkOption { settings = mkOption {
description = "Settings for the heracles dashboards"; description = "Settings for the heracles dashboards";
default = []; default = [];
@ -88,10 +93,10 @@ with lib;
]; ];
}''; }'';
}; };
dataPath = mkOption { dataPath = mkOption rec {
description = "Storage path for the tsdb"; description = "Storage path for the tsdb";
default = "/Users/zaphar/opt/prometheus"; default = "/Users/zaphar/opt/prometheus";
defaultText = "~/opt/prometheus"; defaultText = default;
}; };
}; };
@ -126,8 +131,8 @@ with lib;
WatchPaths = [ WatchPaths = [
"/etc/${config.environment.etc."heracles.yaml".target}" "/etc/${config.environment.etc."heracles.yaml".target}"
]; ];
StandardOutPath = "/var/log/heracles.log"; StandardOutPath = "${config.services.heracles.logsPath}/heracles.log";
StandardErrorPath = "/var/log/heracles.err.log"; StandardErrorPath = "${config.services.heracles.logsPath}/heracles.err.log";
KeepAlive = true; KeepAlive = true;
RunAtLoad = true; RunAtLoad = true;
}; };
@ -153,10 +158,10 @@ with lib;
"${pkgs.prometheus}/bin/prometheus" "${pkgs.prometheus}/bin/prometheus"
"--web.listen-address=${config.services.prometheus.listen}" "--web.listen-address=${config.services.prometheus.listen}"
"--config.file=/etc/${config.environment.etc."prometheus.yaml".target}" "--config.file=/etc/${config.environment.etc."prometheus.yaml".target}"
#"--storage.tsdb.path=${config.services.prometheus.dataPath}" "--storage.tsdb.path=${config.services.prometheus.dataPath}/data"
]; ];
StandardOutPath = "${config.services.prometheus.dataPath}/prometheus-out.log"; #StandardOutPath = "${config.services.prometheus.dataPath}/prometheus.out.log";
StandardErrorPath = "${config.services.prometheus.dataPath}/prometheus-err.log"; #StandardErrorPath = "${config.services.prometheus.dataPath}/prometheus.err.log";
WorkingDirectory = config.services.prometheus.dataPath; WorkingDirectory = config.services.prometheus.dataPath;
WatchPaths = [ WatchPaths = [
"/etc/${config.environment.etc."prometheus.yaml".target}" "/etc/${config.environment.etc."prometheus.yaml".target}"
@ -166,25 +171,25 @@ with lib;
}; };
}; };
environment.etc."newsyslog.d/org.nixos.prometheus.conf" = mkIf config.services.prometheus.enable { #environment.etc."newsyslog.d/org.nixos.prometheus.conf" = mkIf config.services.prometheus.enable {
text = '' # text = ''
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] # # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${config.launchd.user.agents.prometheus.serviceConfig.StandardOutPath} 644 10 1000 * NJ # ${config.launchd.user.agents.prometheus.serviceConfig.StandardOutPath} 644 10 1000 * BNJ
${config.launchd.user.agents.prometheus.serviceConfig.StandardErrorPath} 644 10 1000 * NJ # ${config.launchd.user.agents.prometheus.serviceConfig.StandardErrorPath} 644 10 1000 * BNJ
''; # '';
}; #};
environment.etc."newsyslog.d/org.nixos.heracles.conf" = mkIf config.services.prometheus.enable { environment.etc."newsyslog.d/org.nixos.heracles.conf" = mkIf config.services.prometheus.enable {
text = '' text = ''
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${config.launchd.user.agents.heracles.serviceConfig.StandardOutPath} 644 10 1000 * NJ ${config.launchd.user.agents.heracles.serviceConfig.StandardOutPath} 644 10 1000 * BNJ
${config.launchd.user.agents.heracles.serviceConfig.StandardErrorPath} 644 10 1000 * NJ ${config.launchd.user.agents.heracles.serviceConfig.StandardErrorPath} 644 10 1000 * BNJ
''; '';
}; };
environment.etc."newsyslog.d/org.nixos.durnitisp.conf" = mkIf config.services.durnitisp.enable { environment.etc."newsyslog.d/org.nixos.durnitisp.conf" = mkIf config.services.durnitisp.enable {
text = '' text = ''
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${config.launchd.daemons.durnitisp.serviceConfig.StandardOutPath} 644 10 1000 * NJ ${config.launchd.daemons.durnitisp.serviceConfig.StandardOutPath} 644 10 1000 * BNJ
${config.launchd.daemons.durnitisp.serviceConfig.StandardErrorPath} 644 10 1000 * NJ ${config.launchd.daemons.durnitisp.serviceConfig.StandardErrorPath} 644 10 1000 * BNJ
''; '';
}; };
}; };