I'm under the impression userspace programs are expected to discard logs by default. I've seen various programs dump logs wherever they feel like, and its never particularly welcome on my systems; tending to build up in some location that is never noticed unless/until it gets huge.
I would prefer if there was a definite place for them, I'm playing around on my system trying to find a stable place for them.
My first idea was to use /var/run/user/$UID/log
, but found that on my system, that is a TMPFS mount, not large enough, or really good for use with logs.
Create a place for them
Since I dont understand /var/run/user well enough to integrate with it, I've chosen to emulate it by hand, for user 1000.
# mkdir /var/log/user
# install -d /var/log/user/1000 --owner 1000 -g 1000 -m 0700
I would recommend sticking to the FHS /var/log spc for the structure within this folder, but the spec free-form so there isn't much to comply with.
Logrotate Config
There is no existing log rotation on this directory provided by your system, I recommend creating one for your system:
# /etc/logrotate.d/userlogs
/var/log/user/*/log/*.log
/var/log/user/*/log/**/*.log
{
daily
missingok
rotate 7
compress
notifempty
nocreate
}
Below is my previous /var/run/user/1000/log post, I cannot recommend it unless you really know what your doing (And if you do, tell me how to too!)
maybe as follows, but I just made this up because it made sense to me.
/var/run/user/1000/log/<app>.log
/var/run/user/1000/log/<app>/<context>.log
Integrate with /var/log/user/1000:
# Integrate with above /var/run/user, probably a bad idea:
# ln -s /var/log/user/1000/ /var/run/user/1000/log