Artix Linux Forum

Init systems => dinit => Topic started by: omnigenous on 28 May 2024, 15:04:57

Title: [SOLVED] Log dir for user instance services
Post by: omnigenous on 28 May 2024, 15:04:57
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`.
Title: Re: Log dir for user instance services
Post by: konimex on 28 May 2024, 15:50:57
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.
Title: Re: [SOLVED] Log dir for user instance services
Post by: capezotte on 30 May 2024, 01:04:51
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.