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

View File

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

View File

@ -169,6 +169,7 @@ with lib;
"--out-path=${heraclesOutPath}"
"--err-path=${heraclesErrPath}"
"--pid-file=${heraclesPidPath}"
"--paranoid"
"--"
"${pkgs.heracles}/bin/heracles"
"--listen=${config.services.heracles.listen}"
@ -189,6 +190,7 @@ with lib;
"--out-path=${durnitispOutPath}"
"--err-path=${durnitispErrPath}"
"--pid-file=${durnitispPidPath}"
"--paranoid"
"--"
"${pkgs.durnitisp}/bin/durnitisp"
"--listenHost=${config.services.durnitisp.listen}"
@ -206,6 +208,7 @@ with lib;
"--out-path=${prometheusOutPath}"
"--err-path=${prometheusErrPath}"
"--pid-file=${prometheusPidPath}"
"--paranoid"
"--"
"${pkgs.prometheus}/bin/prometheus"
"--web.listen-address=${config.services.prometheus.listen}"
@ -228,13 +231,13 @@ with lib;
${prometheusErrPath} zaphar:staff 644 10 1000 * BJ ${prometheusPidPath} 1
'';
};
environment.etc."newsyslog.d/org.nixos.heracles.conf" = mkIf config.services.prometheus.enable {
text = ''
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${heraclesOutPath} zaphar:staff 644 10 1000 * BJ ${heraclesPidPath} 1
${heraclesErrPath} zaphar:staff 644 10 1000 * BJ ${heraclesPidPath} 1
'';
};
#environment.etc."newsyslog.d/org.nixos.heracles.conf" = mkIf config.services.prometheus.enable {
# text = ''
# # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
# ${heraclesOutPath} 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 {
text = ''
# 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}"
"--err-path=${config.services.vector.stderrPath}"
"--pid-file=${config.services.vector.pidPath}"
"--paranoid"
"--"
"${pkgs.vector}/bin/vector"
"--verbose"
"--watch-config"
"--config=/etc/${config.environment.etc."vector.yaml".target}"
];
WatchPaths= [
"/etc/${config.environment.etc."vector.yaml".target}"
];
KeepAlive = true;
RunAtLoad = true;
};

View File

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