Logging for runit on Void Linux with svlogger
Posted by Dave Eddy on Sep 26 2018 - tags: techUpdate 10/01/2018
svlogger
can be easily replicated with vlogger(8), which is shipped
with void-runit. This comment from
Duncaen on reddit explains it:
I wrote vlogger(8) which works similar, by default it logs to syslog and if
/etc/vlogger
is an executable file it will exec into/etc/vlogger
with the service name as argument.The script would be something like this:
#!/bin/sh exec svlogd /var/log/$1
The main idea is to make it simple to switch from logging to syslog to svlogd by just creating
/etc/vlogger
. Its part of therunit-void
package and services could be shipped with this as default at some point.
I created /etc/vlogger
as an executable with the following contents:
#!/bin/sh
logdir=/tmp/sv/log/$1
mkdir -p "$logdir"
exec svlogd -tt "$logdir"
Updated my existing log services with:
cd /var/service
for f in */log/run; do sudo ln -svf /usr/bin/vlogger "$f"; done
And restarted them with:
sudo sv restart /var/service/*/log
The rest of the post is left here for historical purposes.
I’ve been using Void Linux on my laptop for the last month or
so and it has just been fantastic; using runit to manage services has
been so incredibly easy. I wrote vsv to make the output a little more
colorful and the usage slightly easier, but even just using sv
directly has
just been great.