How do you handle runit logs?

Martin Steigerwald martin at lichtvoll.de
Tue Aug 1 21:55:59 BST 2023


Hi Steve.

Welcome on this list.

Steve Litt - 01.08.23, 22:08:10 CEST:
> I'm going to be creating some runit run scripts for inclusion in the
> runit-services package.

Thank you for that.

> How do you handle logging facilities in the service/log directory?
> Different people have different system loggers, so do I use an
> environment variable for the system logging program, and if so, what's
> the name and path of the system logger.

Lorenzo like can give more accurate info on that, but till then, let me 
share what I learned:

As I created a zcfan service - still need to do a merge request about 
that, but AFAIR I mostly blatantly copied and adapted from chrony 
service - I found that when you have an empty file like

/usr/share/runit/sv/chrony/.meta/logscript

in the meta directory of your service, then I think "cpsv" will do this:

% ls -l /etc/sv/chrony/log/run 
lrwxrwxrwx 1 root root 18 23. Jan 2023  /etc/sv/chrony/log/run -> /etc/
sv/svlogd/run

The script "/etc/sv/svlogd/run" is part of the runit package and uses 
svlogd with a user "_runit-log" to log into "/var/log/runit".

Maybe that default mechanism is suitable for most cases.

I generally suggest for you to have a look at "/usr/share/runit/sv" as 
well as the manpage for "cpsv" to see how think are done.

Of course in case you see anything that could be improved here, please 
share. For me this default mechanism did well.

Lorenzo may be able to share additional details.

Best,
-- 
Martin





More information about the Debian-init-diversity mailing list