Re: ca catchall logger prefix log lines with service names?

From: Peter Shkenev <>
Date: Tue, 25 Oct 2022 19:23:18 +0300


On Tue Oct 25, 2022 at 14:19 UTC, Ihor Antonov wrote:

> I am trying to figure out if I can set up svscan catchall logger in such
> a way that it prepends a service name to every log line, so that it can
> be clear where the log came from.

Service dirs are made for this. s6-log does not know the name of service
- it just writes data from stdin to log directory, appending timestamps
and handling rotation.

> I am trying to avoid s6-rc setup where I need to explicitly create a
> matching logger service.

Having logger per service is the intended pattern for s6/s6-rc. This
sets s6 logging framework apart from syslog and systemd-journald. s6
overview[1] and s6-log documentation[2] describes why logging is
designed this way.

And, again, s6-rc v1 and s6-frontend will make this easier. I am looking
forward for them too.

> Today I do this:
> s6-svscan $S6_RC_DIR | s6-log -- t s16777216 n64 $HOME/.local/log/svscan

As Laurent stated in the previous thread, do not do that. s6-svscan is
not meant to be run in the terminal.

> _at_400000006356da4b2cb3ba0a - a timestamp?

Yes, this is a TAI64N timestamp. TAI64N is a reliable way to store
timestamps[3], since it does not have leap seconds and does not suffer
from problems like Y2K and Y2038. Also, these timestamps are easily

If you want to read a log file with TAI64N timestamp, you can pipe it
through s6-tai64nlocal program:
    cat $LOGDIR/current | s6-tai64nlocal | less

Also, s6-log supports writing ISO 8601 timestamps, see s6-log
documentation[2] for details.


Best regards,
Received on Tue Oct 25 2022 - 18:23:18 CEST

This archive was generated by hypermail 2.4.0 : Tue Oct 25 2022 - 18:41:59 CEST