Skip to content

Commit

Permalink
Merge pull request #1146 from emilazy/push-ylsrzmyxtlor
Browse files Browse the repository at this point in the history
prometheus-node-exporter: fix log permissions
  • Loading branch information
emilazy authored Nov 5, 2024
2 parents 2f05a81 + 84d14d4 commit 0e3f3f0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/services/monitoring/prometheus-node-exporter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ in {
users.users._prometheus-node-exporter = {
uid = config.ids.uids._prometheus-node-exporter;
gid = config.ids.gids._prometheus-node-exporter;
home = "/var/empty";
home = "/var/lib/prometheus-node-exporter";
createHome = true;
shell = "/usr/bin/false";
description = "System user for the Prometheus Node exporter";
};
Expand All @@ -104,11 +105,14 @@ in {
++ (map (collector: "--collector.${collector}") cfg.enabledCollectors)
++ (map (collector: "--no-collector.${collector}") cfg.disabledCollectors)
) + escapeShellArgs cfg.extraFlags;
serviceConfig = {
serviceConfig = let
logPath = config.users.users._prometheus-node-exporter.home
+ "/prometheus-node-exporter.log";
in {
KeepAlive = true;
RunAtLoad = true;
StandardErrorPath = "/var/log/prometheus-node-exporter.log";
StandardOutPath = "/var/log/prometheus-node-exporter.log";
StandardErrorPath = logPath;
StandardOutPath = logPath;
GroupName = "_prometheus-node-exporter";
UserName = "_prometheus-node-exporter";
};
Expand Down

0 comments on commit 0e3f3f0

Please sign in to comment.