aitor said on Tue, 16 Sep 2025 16:47:04 +0200
>Hi Steve,
>
>On 16/9/25 3:43, Steve Litt wrote:
>> So where do all of you think the logs belong for a runsvdir run as a
>> normal user (slitt in this case)?
>
>The drawback of using /home is that it may be mounted over network
>filesystems.
>
>I'm aware that you haven't great sympathy for the hipsters of
>freedesktop, but there is a directory used by the different user
>services that need a placeĀ for their lock files, pid files, log files
>and sockets.
>
>https://specifications.freedesktop.org/basedir-spec/latest
>
>According to the specifications:
>
>"There is a single base directory relative to which
> user-specific runtime files and other file objects should
> be placed. This directory is defined by the environment
> variable|$XDG_RUNTIME_DIR"|
Thanks Aitor!
I just echoed XDG_RUNTIME_DIR on my Void Linux machine and got no
output. So $XDG_RUNTIME_DIR might be a great alternative for
freedesktopy distros, but it's not universal.
>I thought that "/run/user/$UID" was created by pam-systemd, but this
>directory already exists in my devuan system.
My Void Linux system has /run/user already, and it would be simple to
create a /run/user/slitt directory that's owned by slitt. Below that I
could have /run/user/slitt/fetchmail, /run/user/slitt/pulseaudio,
/run/user/slitt/pager, etc. This would certainly work and is certainly
reasonable, always assuming /run is on a partition big enough to
accommodate growing log files.
>Prior to it, user
>services typically stored their files in /tmp. Maybe they considered
>it inappropriate as it's writable by everyone.
/tmp doesn't work because it's often a tmpfs "filesystem", in which
case all your logs disappear upon reboot. And even if /tmp is a real
disk partition, it's often not big enough to accommodate lots of log
files. And yes, it's writeable by anybody, and in certain cases a
badguy could delete log files or modify them.
As more and more people write me with suggestions, it seems to me that
the answer is "it depends".
From my perspective, the first question to be answered is whether I
want my logs to be in the same tree as my data, and backed up with my
data. In my case, the answer is "no". So, like some people have pointed
out, I personally am not going to have my logs anywhere in the /home
tree.
Somebody suggested putting it in the /var/log/slitt/fetchmail, etc,
with the proper directory ownership and permissions. This is certainly
an expected place, very similar to /run/user/slitt/fetchmail, except
that /var/log is where log files are expected, so it's presumably sized
for them and easy to remember and find.
If I person *does* consider the logs data, then something in /home is
certainly a great idea. Djb's putting them under
$servicedir/fetchmail/log/logs has a nice expectancy to it.
And of course, a whole different school of thought is that you should
just feed the logs to whatever logging system is running on the
computer, which has the advantage of showing this daemon's events in
time context with other events, and the disadvantage of having this
daemon's events scattered and hard to find.
In my documentation I think I'll need to discuss that this is a decision
based on the situation. In my particular use case, I don't want these
logs backed up at all, so I might end up putting them under my /scratch
tree, which specifically does not get backed up.
I really value all the opinions you and everyone else is giving me.
Based on the responses, I think there's no one-size-fits-all right
answer, and that's something I wouldn't have realized if not for yours
and other peoples' input.
Thanks,
SteveT
Steve Litt
http://444domains.com
Received on Tue Sep 16 2025 - 17:32:33 CEST