From d1f33c1172e0b4f186d12a35f4747b8a858ad959 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 2 Dec 2021 17:23:14 +0100 Subject: [PATCH] systemd: set WorkingDirectory to fix relative mkdir Loki 2.4.1 tries to `mkdir` a path relative to the working directory, which is problematic when it is not set to a path that is writeable by the loki user. > level=error ts=2021-12-02T16:18:14.974316503Z caller=log.go:106 msg="error running loki" err="mkdir wal: permission denied [...]" Fixes this by setting the working directory to lokis storage directory. Signed-off-by: Martin Weinelt --- templates/loki.service.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/loki.service.j2 b/templates/loki.service.j2 index f219053..50bd145 100644 --- a/templates/loki.service.j2 +++ b/templates/loki.service.j2 @@ -9,6 +9,7 @@ Type=simple Environment="GOMAXPROCS={{ ansible_processor_vcpus|default(ansible_processor_count) }}" User={{ loki_user }} Group={{ loki_group }} +WorkingDirectory={{ loki_storage_dir }} ExecReload=/bin/kill -HUP $MAINPID ExecStart=/usr/local/bin/loki \ -config.file {{ loki_config_dir }}/loki.yml