feat: use clio to help make the log rotation work

This commit is contained in:
Jeremy Wall 2024-06-04 20:26:07 -04:00
parent 40a74fc8a7
commit 57e230f483
6 changed files with 427 additions and 180 deletions

View File

@ -169,33 +169,42 @@
prometheus = {
type = "file";
include = [
"${config.launchd.user.agents.prometheus.serviceConfig.StandardOutPath}"
"${config.launchd.user.agents.prometheus.serviceConfig.StandardErrorPath}"
config.services.prometheus.stdoutPath
config.services.prometheus.stderrPath
];
};
heracles = {
type = "file";
include = [
"${config.launchd.user.agents.heracles.serviceConfig.StandardOutPath}"
"${config.launchd.user.agents.heracles.serviceConfig.StandardErrorPath}"
config.services.heracles.stdoutPath
config.services.heracles.stderrPath
];
};
# TODO(zaphar): We should remap durnitisp output to get strip the tty control characters.
# TODO(zaphar): We should remap durnitisp output to strip the TTY control characters.
durnitisp = {
type = "file";
include = [
"${config.launchd.daemons.durnitisp.serviceConfig.StandardOutPath}"
"${config.launchd.daemons.durnitisp.serviceConfig.StandardErrorPath}"
config.services.durnitisp.stdoutPath
config.services.durnitisp.stderrPath
];
};
vector = {
type = "file";
include = [
"${config.launchd.daemons.vector.serviceConfig.StandardOutPath}"
"${config.launchd.daemons.vector.serviceConfig.StandardErrorPath}"
config.services.vector.stdoutPath
config.services.vector.stderrPath
];
};
};
transforms = {
strip_tty = {
type = "remap";
inputs = [
"durnitisp"
];
source = "_msg = strip_ansi_escape_codes(_msg)";
};
};
sinks = {
victoria = {
type = "elasticsearch";

View File

@ -20,6 +20,30 @@
"type": "github"
}
},
"clio-flake": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1717545303,
"narHash": "sha256-WjFMrdMpWAhC4FVGfLp/8j2GqylCdqBuTmatNd7HgXE=",
"owner": "zaphar",
"repo": "clio",
"rev": "ece2e6ad7a9c888f5ead3c6e9e22dfc57574f809",
"type": "github"
},
"original": {
"owner": "zaphar",
"repo": "clio",
"type": "github"
}
},
"d2-vim-src": {
"flake": false,
"locked": {
@ -80,9 +104,9 @@
},
"durnitisp-flake": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"naersk": "naersk"
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3",
"naersk": "naersk_2"
},
"locked": {
"lastModified": 1678814232,
@ -99,6 +123,22 @@
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1641205782,
@ -114,7 +154,7 @@
"type": "github"
}
},
"flake-compat_2": {
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -130,7 +170,7 @@
"type": "github"
}
},
"flake-compat_3": {
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1648199409,
@ -146,7 +186,7 @@
"type": "github"
}
},
"flake-compat_4": {
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1673956053,
@ -163,12 +203,33 @@
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_10": {
"inputs": {
"systems": "systems_8"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
@ -178,24 +239,6 @@
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
@ -213,61 +256,25 @@
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1687709756,
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_7": {
"inputs": {
"systems": "systems_5"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
@ -282,16 +289,85 @@
"type": "github"
}
},
"flake-utils_8": {
"flake-utils_5": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"inputs": {
"systems": "systems_5"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_7": {
"inputs": {
"systems": "systems_6"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"lastModified": 1687709756,
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_8": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_9": {
"inputs": {
"systems": "systems_7"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
@ -340,11 +416,11 @@
},
"heracles-flake": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"naersk": "naersk_2",
"nixpkgs": "nixpkgs_4",
"rust-overlay": "rust-overlay"
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_4",
"naersk": "naersk_3",
"nixpkgs": "nixpkgs_5",
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1716397295,
@ -401,6 +477,24 @@
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1717067539,
"narHash": "sha256-oIs5EF+6VpHJRvvpVWuqCYJMMVW/6h59aYUv9lABLtY=",
"owner": "nix-community",
"repo": "naersk",
"rev": "fa19d8c135e776dc97f4dcca08656a0eeb28d5c0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"naersk_2": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1671096816,
"narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=",
@ -415,9 +509,9 @@
"type": "github"
}
},
"naersk_2": {
"naersk_3": {
"inputs": {
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1698420672,
@ -433,9 +527,9 @@
"type": "github"
}
},
"naersk_3": {
"naersk_4": {
"inputs": {
"nixpkgs": "nixpkgs_9"
"nixpkgs": "nixpkgs_10"
},
"locked": {
"lastModified": 1650101877,
@ -469,8 +563,8 @@
},
"neovim-flake": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_5"
"flake-utils": "flake-utils_6",
"nixpkgs": "nixpkgs_6"
},
"locked": {
"dir": "contrib",
@ -491,9 +585,9 @@
},
"nil-flake": {
"inputs": {
"flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_6",
"rust-overlay": "rust-overlay_2"
"flake-utils": "flake-utils_7",
"nixpkgs": "nixpkgs_7",
"rust-overlay": "rust-overlay_3"
},
"locked": {
"lastModified": 1694177726,
@ -542,6 +636,20 @@
}
},
"nixpkgs_10": {
"locked": {
"lastModified": 1650109093,
"narHash": "sha256-tqlnKrAdJktRLXTou9le0oTqrYBAFpGscV5RADdpArU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "faad370edcb37162401be50d45526f52bb16a713",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_11": {
"locked": {
"lastModified": 1682109806,
"narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=",
@ -559,11 +667,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1678724065,
"narHash": "sha256-MjeRjunqfGTBGU401nxIjs7PC9PZZ1FBCZp/bRB3C2M=",
"lastModified": 1717399147,
"narHash": "sha256-eCWaE/q1VItpFAxxLVt171MdtDcjEnwi6QB/yuF73JU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b8afc8489dc96f29f69bec50fdc51e27883f89c1",
"rev": "4a4ecb0ab415c9fccfb005567a215e6a9564cdf5",
"type": "github"
},
"original": {
@ -573,11 +681,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1708151420,
"narHash": "sha256-MGT/4aGCWQPQiu6COqJdCj9kSpLPiShgbwpbC38YXC8=",
"lastModified": 1678724065,
"narHash": "sha256-MjeRjunqfGTBGU401nxIjs7PC9PZZ1FBCZp/bRB3C2M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6e2f00c83911461438301db0dba5281197fe4b3a",
"rev": "b8afc8489dc96f29f69bec50fdc51e27883f89c1",
"type": "github"
},
"original": {
@ -600,6 +708,20 @@
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1708151420,
"narHash": "sha256-MGT/4aGCWQPQiu6COqJdCj9kSpLPiShgbwpbC38YXC8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6e2f00c83911461438301db0dba5281197fe4b3a",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1715787315,
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
@ -615,7 +737,7 @@
"type": "github"
}
},
"nixpkgs_6": {
"nixpkgs_7": {
"locked": {
"lastModified": 1690441914,
"narHash": "sha256-Ac+kJQ5z9MDAMyzSc0i0zJDx2i3qi9NjlW5Lz285G/I=",
@ -631,7 +753,7 @@
"type": "github"
}
},
"nixpkgs_7": {
"nixpkgs_8": {
"locked": {
"lastModified": 1717179513,
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
@ -647,7 +769,7 @@
"type": "github"
}
},
"nixpkgs_8": {
"nixpkgs_9": {
"locked": {
"lastModified": 1689850295,
"narHash": "sha256-fUYf6WdQlhd2H+3aR8jST5dhFH1d0eE22aes8fNIfyk=",
@ -663,23 +785,9 @@
"type": "github"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1650109093,
"narHash": "sha256-tqlnKrAdJktRLXTou9le0oTqrYBAFpGscV5RADdpArU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "faad370edcb37162401be50d45526f52bb16a713",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nurl-flake": {
"inputs": {
"nixpkgs": "nixpkgs_8"
"nixpkgs": "nixpkgs_9"
},
"locked": {
"lastModified": 1701273941,
@ -698,6 +806,7 @@
"root": {
"inputs": {
"agenix-flake": "agenix-flake",
"clio-flake": "clio-flake",
"d2-vim-src": "d2-vim-src",
"darwin": "darwin_2",
"durnitisp-flake": "durnitisp-flake",
@ -706,7 +815,7 @@
"neogit-src": "neogit-src",
"neovim-flake": "neovim-flake",
"nil-flake": "nil-flake",
"nixpkgs": "nixpkgs_7",
"nixpkgs": "nixpkgs_8",
"nixpkgs-darwin": "nixpkgs-darwin",
"nurl-flake": "nurl-flake",
"roslyn-lsp": "roslyn-lsp",
@ -736,9 +845,9 @@
},
"runwhen-flake": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_6",
"naersk": "naersk_3"
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_8",
"naersk": "naersk_4"
},
"locked": {
"lastModified": 1695686584,
@ -756,7 +865,51 @@
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"clio-flake",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717442957,
"narHash": "sha256-w0fqHofxM2hf3pGDXCPSdH0A09v6FgHm6I38nCWA96k=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "025e1742de4fa75b3fb63818bd9726d17da6a102",
"type": "github"
},
"original": {
"owner": "oxalica",
"ref": "stable",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay-flake": {
"inputs": {
"flake-utils": "flake-utils_9",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708481452,
"narHash": "sha256-s07K6pwJtnB7Z/3wbkf4iaYXj+H5CuDD94I8hohm3Ig=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "3d6647bf9d1f8e537b0d026c51ea25c0cdd92055",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"flake-utils": "flake-utils_5",
"nixpkgs": [
"heracles-flake",
"nixpkgs"
@ -777,28 +930,7 @@
"type": "github"
}
},
"rust-overlay-flake": {
"inputs": {
"flake-utils": "flake-utils_7",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708481452,
"narHash": "sha256-s07K6pwJtnB7Z/3wbkf4iaYXj+H5CuDD94I8hohm3Ig=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "3d6647bf9d1f8e537b0d026c51ea25c0cdd92055",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"rust-overlay_3": {
"inputs": {
"flake-utils": [
"nil-flake",
@ -825,11 +957,11 @@
},
"sile-flake": {
"inputs": {
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_8",
"flake-compat": "flake-compat_5",
"flake-utils": "flake-utils_10",
"gitignore": "gitignore",
"libtexpdf-src": "libtexpdf-src",
"nixpkgs": "nixpkgs_10"
"nixpkgs": "nixpkgs_11"
},
"locked": {
"lastModified": 1694595810,
@ -935,6 +1067,36 @@
"type": "github"
}
},
"systems_7": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_8": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treesitter-context": {
"flake": false,
"locked": {

View File

@ -21,6 +21,10 @@
nil-flake = {
url = "github:oxalica/nil";
};
clio-flake = {
url = "github:zaphar/clio";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay-flake = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
@ -74,6 +78,7 @@
unstable,
heracles-flake,
neovim-flake,
clio-flake,
... # We don't use the self or nixpkgs args here so we just glob it.
}:
rec {
@ -225,6 +230,7 @@ EOF";
sile = sile-flake.defaultPackage.${system};
age = agenix-flake.packages."${system}".default;
nurl = nurl-flake.packages."${system}".default;
clio = clio-flake.packages."${system}".default;
unstablePkgs = import unstable { inherit system; };
#lean4Pkg = lean4-flake.defaultPackage."${system}";
in { config, pkgs, ... }: let
@ -244,6 +250,7 @@ EOF";
ccache = prev.ccache.override { doCheck = false; };
heracles = heracles-flake.packages."${system}".default;
durnitisp = durnitisp;
clio = clio;
})
rust-overlay
];

View File

@ -23,6 +23,15 @@ with lib;
default = "/Users/zaphar/opt/heracles";
defaultText = default;
};
stdoutPath = mkOption {
default = "${config.services.heracles.logsPath}/heracles.out.log";
};
stderrPath = mkOption {
default = "${config.services.heracles.logsPath}/heracles.out.log";
};
pidPath = mkOption {
default = "${config.services.heracles.logsPath}/heracles.pid";
};
settings = mkOption {
description = "Settings for the heracles dashboards";
default = [];
@ -37,6 +46,16 @@ with lib;
default = "localhost:9002";
defaultText = "localhost:9002";
};
stdoutPath = mkOption {
default = "/var/log/durnitisp.out.log";
};
stderrPath = mkOption {
default = "/var/log/durnitisp.out.log";
};
# TODO(zaphar): Should this be written somewhere else?
pidPath = mkOption {
default = "/var/log/durnitisp.pid";
};
};
options.services.prometheus = {
@ -46,6 +65,15 @@ with lib;
default = "localhost:9000";
defaultText = "localhost:9000";
};
stdoutPath = mkOption {
default = "${config.services.prometheus.dataPath}/prometheus.out.log";
};
stderrPath = mkOption {
default = "${config.services.prometheus.dataPath}/prometheus.out.log";
};
pidPath = mkOption {
default = "${config.services.prometheus.dataPath}/prometheus.pid";
};
settings = mkOption {
description = "The yaml configuration file settings for prometheus";
default = {
@ -101,7 +129,20 @@ with lib;
};
config = {
config = let
heraclesOutPath = config.services.heracles.stdoutPath;
heraclesErrPath = config.services.heracles.stderrPath;
heraclesPidPath = config.services.heracles.pidPath;
durnitispOutPath = config.services.durnitisp.stdoutPath;
durnitispErrPath = config.services.durnitisp.stderrPath;
durnitispPidPath = config.services.durnitisp.pidPath;
prometheusOutPath = config.services.prometheus.stdoutPath;
prometheusErrPath = config.services.prometheus.stderrPath;
prometheusPidPath = config.services.prometheus.pidPath;
in
{
launchd.user.agents.node-exporter = mkIf config.services.node-exporter.enable {
serviceConfig = {
ProgramArguments = [
@ -124,6 +165,11 @@ with lib;
launchd.user.agents.heracles = mkIf config.services.heracles.enable {
serviceConfig = {
ProgramArguments = [
"${pkgs.clio}/bin/clio"
"--out-path=${heraclesOutPath}"
"--err-path=${heraclesErrPath}"
"--pid-file=${heraclesPidPath}"
"--"
"${pkgs.heracles}/bin/heracles"
"--listen=${config.services.heracles.listen}"
"--config=/etc/${config.environment.etc."heracles.yaml".target}"
@ -131,8 +177,6 @@ with lib;
WatchPaths = [
"/etc/${config.environment.etc."heracles.yaml".target}"
];
StandardOutPath = "${config.services.heracles.logsPath}/heracles.log";
StandardErrorPath = "${config.services.heracles.logsPath}/heracles.err.log";
KeepAlive = true;
RunAtLoad = true;
};
@ -141,13 +185,16 @@ with lib;
launchd.daemons.durnitisp = mkIf config.services.durnitisp.enable {
serviceConfig = {
ProgramArguments = [
"${pkgs.clio}/bin/clio"
"--out-path=${durnitispOutPath}"
"--err-path=${durnitispErrPath}"
"--pid-file=${durnitispPidPath}"
"--"
"${pkgs.durnitisp}/bin/durnitisp"
"--listenHost=${config.services.durnitisp.listen}"
];
KeepAlive = true;
StandardOutPath = "/var/log/durnitisp.log";
StandardErrorPath = "/var/log/durnitisp.err.log";
RunAtLoad = true;
};
};
@ -155,13 +202,16 @@ with lib;
launchd.user.agents.prometheus = mkIf config.services.prometheus.enable {
serviceConfig = {
ProgramArguments = [
"${pkgs.clio}/bin/clio"
"--out-path=${prometheusOutPath}"
"--err-path=${prometheusErrPath}"
"--pid-file=${prometheusPidPath}"
"--"
"${pkgs.prometheus}/bin/prometheus"
"--web.listen-address=${config.services.prometheus.listen}"
"--config.file=/etc/${config.environment.etc."prometheus.yaml".target}"
"--storage.tsdb.path=${config.services.prometheus.dataPath}/data"
];
StandardOutPath = "${config.services.prometheus.dataPath}/prometheus.out.log";
StandardErrorPath = "${config.services.prometheus.dataPath}/prometheus.err.log";
WorkingDirectory = config.services.prometheus.dataPath;
WatchPaths = [
"/etc/${config.environment.etc."prometheus.yaml".target}"
@ -173,23 +223,23 @@ with lib;
environment.etc."newsyslog.d/org.nixos.prometheus.conf" = mkIf config.services.prometheus.enable {
text = ''
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${config.launchd.user.agents.prometheus.serviceConfig.StandardOutPath} zaphar:staff 644 10 1000 * BNJ
${config.launchd.user.agents.prometheus.serviceConfig.StandardErrorPath} zaphar:staff 644 10 1000 * BNJ
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${prometheusOutPath} zaphar:staff 644 10 1000 * BNJ ${prometheusPidPath} 1
${prometheusErrPath} zaphar:staff 644 10 1000 * BNJ ${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]
${config.launchd.user.agents.heracles.serviceConfig.StandardOutPath} zaphar:staff 644 10 1000 * BNJ
${config.launchd.user.agents.heracles.serviceConfig.StandardErrorPath} zaphar:staff 644 10 1000 * BNJ
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${heraclesOutPath} zaphar:staff 644 10 1000 * BNJ ${heraclesPidPath} 1
${heraclesErrPath} zaphar:staff 644 10 1000 * BNJ ${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]
${config.launchd.daemons.durnitisp.serviceConfig.StandardOutPath} zaphar:staff 644 10 1000 * BNJ
${config.launchd.daemons.durnitisp.serviceConfig.StandardErrorPath} zaphar:staff 644 10 1000 * BNJ
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
${durnitispOutPath} zaphar:staff 644 10 1000 * BNJ ${prometheusPidPath} 1
${durnitispErrPath} zaphar:staff 644 10 1000 * BNJ ${prometheusPidPath} 1
'';
};
};

View File

@ -10,6 +10,15 @@ with lib;
};
defaultText = "{}";
};
stdoutPath = mkOption {
default = "/var/log/vector.out.log";
};
stderrPath = mkOption {
default = "/var/log/vector.out.log";
};
pidPath = mkOption {
default = "/var/log/vector.pid";
};
};
config = {
@ -20,14 +29,17 @@ with lib;
launchd.daemons.vector = mkIf config.services.vector.enable {
serviceConfig = {
ProgramArguments = [
"${pkgs.clio}/bin/clio"
"--out-path=${config.services.vector.stdoutPath}"
"--err-path=${config.services.vector.stderrPath}"
"--pid-file=${config.services.vector.pidPath}"
"--"
"${pkgs.vector}/bin/vector"
"--watch-config"
"--config=/etc/${config.environment.etc."vector.yaml".target}"
];
KeepAlive = true;
RunAtLoad = true;
StandardOutPath = "/var/log/vector.out.log";
StandardErrorPath = "/var/log/vector.err.log";
};
};
};

View File

@ -15,18 +15,25 @@ with lib;
};
};
config = {
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";
in {
launchd.user.agents.victoria-logs = mkIf config.services.victoria-logs.enable {
serviceConfig = {
ProgramArguments = [
"${pkgs.clio}/bin/clio"
"--out-path=${victoria-logsOutPath}"
"--err-path=${victoria-logsErrPath}"
"--pid-file=${victoria-logsPidPath}"
"--"
"${pkgs.victoriametrics}/bin/victoria-logs"
"-storageDataPath=${config.services.victoria-logs.dataPath}/data"
"-httpListenAddr=${config.services.victoria-logs.listenAddr}"
];
KeepAlive = true;
RunAtLoad = true;
StandardOutPath = "${config.services.victoria-logs.dataPath}/victoria-logs.out.log";
StandardErrorPath = "${config.services.victoria-logs.dataPath}/victoria-logs.err.log";
};
};
};