Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Log dir for user instance services (Read 337 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] Log dir for user instance services

Cross-posting from https://github.com/davmac314/dinit/discussions/336

What is appropriate directory to store services log files when running dinit as user instance?

For system instance we use `/var/log/dinit` but if `logfile` in user instance points to that dir dinit will, expectantly, return an error: `dinit: SERVICE: execution failed - opening log file: Permission denied`.

Re: Log dir for user instance services

Reply #1
Honestly, I never thought about it. I never encountered services which need it (since you'll also need to set up logrotate, etc.).

But since system services go to /var (a.k.a. LOCALSTATEDIR), if I were to follow XDG spec, I'd put it in $HOME/.local/state (a.k.a. $XDG_STATE_HOME by default.)

So if system log goes to /var/log/dinit, I'd personally put user logs in $HOME/.local/state/log/dinit.

But I usually use log-type = buffer anyway.
now only the dinit guy in artix

Re: [SOLVED] Log dir for user instance services

Reply #2
I personally (re)use ~/.var/log for my user services (and since I use s6, having something like log-type = buffer is actually more work and rotation comes for free).

I hadn't thought to look for the XDG sanctioned equivalent for /var, and it seems Flatpak developers found it weird too.

As dinit's second-in-command said in the original issue, it's a matter of Policy™, and still not a settled one XD.