Update: clio and add some more logging facilities

This commit is contained in:
Jeremy Wall 2024-06-07 20:22:19 -04:00
parent e45db483c4
commit fc2e493f0a
5 changed files with 56 additions and 22 deletions

View File

@ -176,13 +176,13 @@
config.services.prometheus.stderrPath config.services.prometheus.stderrPath
]; ];
}; };
heracles = { #heracles = {
type = "file"; # type = "file";
include = [ # include = [
config.services.heracles.stdoutPath # config.services.heracles.stdoutPath
config.services.heracles.stderrPath # config.services.heracles.stderrPath
]; # ];
}; #};
# TODO(zaphar): We should remap durnitisp output to strip the TTY control characters. # TODO(zaphar): We should remap durnitisp output to strip the TTY control characters.
durnitisp = { durnitisp = {
type = "file"; type = "file";
@ -198,6 +198,19 @@
config.services.vector.stderrPath config.services.vector.stderrPath
]; ];
}; };
victoria-logs = {
type = "file";
include = [
config.services.victoria-logs.stdoutPath
config.services.victoria-logs.stderrPath
];
};
system = {
type = "file";
include = [
"/var/log/system.log"
];
};
}; };
transforms = { transforms = {
durnitisp_no_tty = { durnitisp_no_tty = {
@ -215,13 +228,15 @@
type = "elasticsearch"; type = "elasticsearch";
mode = "bulk"; mode = "bulk";
endpoints = [ endpoints = [
"http://${config.services.victoria-logs.listenAddr}/insert/elasticsearch/" "http://${config.services.victoria-logs.listenAddr}/insert/elasticsearchk"
]; ];
inputs = [ inputs = [
"prometheus" "prometheus"
"heracles" #"heracles"
"durnitisp_no_tty" "durnitisp_no_tty"
"vector" "vector"
"victoria-logs"
"system"
]; ];
api_version = "v8"; api_version = "v8";
healthcheck.enabled = false; healthcheck.enabled = false;

View File

@ -31,11 +31,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1717600017, "lastModified": 1717808280,
"narHash": "sha256-T7urgiReULANio3FWc99Umu+3WhAAez9HuZnJv6QPXk=", "narHash": "sha256-cuoN7Cs2rXQ+6eI2Hk3ICLJEiN+D4nm6Zo3sga4vACE=",
"owner": "zaphar", "owner": "zaphar",
"repo": "clio", "repo": "clio",
"rev": "a14ecf4c63a703dc15e5a82b1fd7cdbfe6d8f367", "rev": "be80b940df2109bb09852ac600ddab050d8b77e3",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -169,6 +169,7 @@ with lib;
"--out-path=${heraclesOutPath}" "--out-path=${heraclesOutPath}"
"--err-path=${heraclesErrPath}" "--err-path=${heraclesErrPath}"
"--pid-file=${heraclesPidPath}" "--pid-file=${heraclesPidPath}"
"--paranoid"
"--" "--"
"${pkgs.heracles}/bin/heracles" "${pkgs.heracles}/bin/heracles"
"--listen=${config.services.heracles.listen}" "--listen=${config.services.heracles.listen}"
@ -189,6 +190,7 @@ with lib;
"--out-path=${durnitispOutPath}" "--out-path=${durnitispOutPath}"
"--err-path=${durnitispErrPath}" "--err-path=${durnitispErrPath}"
"--pid-file=${durnitispPidPath}" "--pid-file=${durnitispPidPath}"
"--paranoid"
"--" "--"
"${pkgs.durnitisp}/bin/durnitisp" "${pkgs.durnitisp}/bin/durnitisp"
"--listenHost=${config.services.durnitisp.listen}" "--listenHost=${config.services.durnitisp.listen}"
@ -206,6 +208,7 @@ with lib;
"--out-path=${prometheusOutPath}" "--out-path=${prometheusOutPath}"
"--err-path=${prometheusErrPath}" "--err-path=${prometheusErrPath}"
"--pid-file=${prometheusPidPath}" "--pid-file=${prometheusPidPath}"
"--paranoid"
"--" "--"
"${pkgs.prometheus}/bin/prometheus" "${pkgs.prometheus}/bin/prometheus"
"--web.listen-address=${config.services.prometheus.listen}" "--web.listen-address=${config.services.prometheus.listen}"
@ -228,13 +231,13 @@ with lib;
${prometheusErrPath} zaphar:staff 644 10 1000 * BJ ${prometheusPidPath} 1 ${prometheusErrPath} zaphar:staff 644 10 1000 * BJ ${prometheusPidPath} 1
''; '';
}; };
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]
${heraclesOutPath} zaphar:staff 644 10 1000 * BJ ${heraclesPidPath} 1 # ${heraclesOutPath} zaphar:staff 644 10 1000 * BJ ${heraclesPidPath} 1
${heraclesErrPath} zaphar:staff 644 10 1000 * BJ ${heraclesPidPath} 1 # ${heraclesErrPath} zaphar:staff 644 10 1000 * BJ ${heraclesPidPath} 1
''; # '';
}; #};
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]

View File

@ -33,11 +33,16 @@ with lib;
"--out-path=${config.services.vector.stdoutPath}" "--out-path=${config.services.vector.stdoutPath}"
"--err-path=${config.services.vector.stderrPath}" "--err-path=${config.services.vector.stderrPath}"
"--pid-file=${config.services.vector.pidPath}" "--pid-file=${config.services.vector.pidPath}"
"--paranoid"
"--" "--"
"${pkgs.vector}/bin/vector" "${pkgs.vector}/bin/vector"
"--verbose"
"--watch-config" "--watch-config"
"--config=/etc/${config.environment.etc."vector.yaml".target}" "--config=/etc/${config.environment.etc."vector.yaml".target}"
]; ];
WatchPaths= [
"/etc/${config.environment.etc."vector.yaml".target}"
];
KeepAlive = true; KeepAlive = true;
RunAtLoad = true; RunAtLoad = true;
}; };

View File

@ -12,13 +12,22 @@ with lib;
description = "Socket Address to listen on"; description = "Socket Address to listen on";
default = "127.0.0.1:9428"; default = "127.0.0.1:9428";
}; };
stdoutPath = mkOption {
default = "${config.services.victoria-logs.dataPath}/victoria-logs.out.log";
};
stderrPath = mkOption {
default = "${config.services.victoria-logs.dataPath}/victoria-logs.err.log";
};
pidPath = mkOption {
default = "${config.services.victoria-logs.dataPath}/victoria-logs.pid";
};
}; };
}; };
config = let config = let
victoria-logsOutPath = "${config.services.victoria-logs.dataPath}/victoria-logs.out.log"; victoria-logsOutPath = "${config.services.victoria-logs.stdoutPath}";
victoria-logsErrPath = "${config.services.victoria-logs.dataPath}/victoria-logs.err.log"; victoria-logsErrPath = "${config.services.victoria-logs.stderrPath}";
victoria-logsPidPath = "${config.services.victoria-logs.dataPath}/victoria-logs.pid"; victoria-logsPidPath = "${config.services.victoria-logs.pidPath}";
in { in {
launchd.user.agents.victoria-logs = mkIf config.services.victoria-logs.enable { launchd.user.agents.victoria-logs = mkIf config.services.victoria-logs.enable {
serviceConfig = { serviceConfig = {
@ -27,8 +36,10 @@ with lib;
"--out-path=${victoria-logsOutPath}" "--out-path=${victoria-logsOutPath}"
"--err-path=${victoria-logsErrPath}" "--err-path=${victoria-logsErrPath}"
"--pid-file=${victoria-logsPidPath}" "--pid-file=${victoria-logsPidPath}"
"--paranoid"
"--" "--"
"${pkgs.victoria-logs}/bin/victoria-logs" "${pkgs.victoria-logs}/bin/victoria-logs"
"-logNewStreams"
"-storageDataPath=${config.services.victoria-logs.dataPath}/data" "-storageDataPath=${config.services.victoria-logs.dataPath}/data"
"-httpListenAddr=${config.services.victoria-logs.listenAddr}" "-httpListenAddr=${config.services.victoria-logs.listenAddr}"
]; ];