Loki does run from CLI but not as service

Error:

eb 17 15:07:14 grafanacentos loki-linux-amd64[3636]: level=error ts=2022-02-17T14:07:14.829286014Z caller=log.go:106 msg=“error running loki” err="mkdir wal: permission denied\nerror initialising module: ingester\Ngithub.com).initModule\n\t/src>
Feb 17 15:07:14 grafanacentos systemd[1]: loki.service: Main process exited, code=exited, status=1/FAILURE
Feb 17 15:07:14 grafanacentos systemd[1]: loki.service: Failed with result ‘exit-code’.

the CLI:
/opt/loki/loki-linux-amd64 -config.file /opt/loki/loki-local-config.yaml

the service:

[Unit]
Description=Grafana Loki service
After=network.target

[Service]
Type=simple
User=loki
ExecStart=/opt/loki/loki-linux-amd64 -config.file /opt/loki/loki-local-config.yaml

[Install]
WantedBy=multi-user.target

It is not clear to me where is Loki trying to create the wal directory.

Solved, Loki was trying to create wal directory in /wal.

Adding:

common:
  path_prefix: /tmp/loki
  storage:
    filesystem:
      chunks_directory: /tmp/loki/chunks
      rules_directory: /tmp/loki/rules
  replication_factor: 1
  ring:
    instance_addr: 127.0.0.1
    kvstore:
      store: inmemory

to config solver the issue.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.