Skip to main content
Topic: Is it feasible to log all services/add a catch-all logger to runit? (Read 717 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is it feasible to log all services/add a catch-all logger to runit?

One long-standing issue in Artix's runit implementation is services without log folders cluttering the console. They tend to be especially inconvenient for users who don't use DMs, since often, while they're typing their username, password, commands, etc., a log message will come and break the line.

Ideally, I think, every service should have a log folder (maybe with a wrapper script to handle the logging boilerplate, if desired). This way, no logs are lostâ„¢ (unlike what happens with the often suggested "add exec >/dev/null 2>&1 to run file")

If it's not feasible to make every service have such folders, is it at least possible to add a "catch-all logger" service for such occassions? For example:
- exec > /run/stage2.log 2>&1 during /etc/runit/2, right before runsvdir starts. Then every process forked off /etc/runit/2 (eventually, every service of the system), will either log to stage2.log, or to the "sub-service" in the log folder.
- An unsupervised svlogd process where stage 2's stdout goes to.
- Skarnet-style fifo trick, which would allow a supervised "catch-all logger" (but might require patching runsv so it ignores SIGPIPE).


This way, such services, rather than clogging the console, would be sent to a "well behaved", standard place.

Re: Is it feasible to log all services/add a catch-all logger to runit?

Reply #1
For example:
- exec > /run/stage2.log 2>&1 during /etc/runit/2, right before runsvdir starts. Then every process forked off /etc/runit/2 (eventually, every service of the system), will either log to stage2.log, or to the "sub-service" in the log folder.
- An unsupervised svlogd process where stage 2's stdout goes to.
- Skarnet-style fifo trick, which would allow a supervised "catch-all logger" (but might require patching runsv so it ignores SIGPIPE).
One more example which i use myself in custom scripts set:
Code: [Select]
mkfifo /run/sidal.log
logger -t sidal < /run/sidal.log &
start-services-command 2> /run/sidal.log
ARMtix