From: "Peter Shkenev" <petershh@disroot.org>
To: "Ihor Antonov" <ihor@antonovs.family>, <supervision@list.skarnet.org>
Subject: Re: ca catchall logger prefix log lines with service names?
Date: Tue, 25 Oct 2022 19:23:18 +0300 [thread overview]
Message-ID: <CNV55NYYYZBD.U2TPKPLOEBHA@ulyaptyap> (raw)
In-Reply-To: <20221025141920.rxxk6qkxpggloryt@localhost>
Hello,
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.
> @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
machine-readable.
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.
[1] https://skarnet.org/software/s6/overview.html
[2] https://skarnet.org/software/s6/s6-log.html
[3] http://skarnet.org/software/skalibs/libstddjb/tai.html
---
Best regards,
Peter
prev parent reply other threads:[~2022-10-25 16:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 14:19 Ihor Antonov
2022-10-25 16:12 ` Laurent Bercot
2022-10-25 16:23 ` Peter Shkenev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CNV55NYYYZBD.U2TPKPLOEBHA@ulyaptyap \
--to=petershh@disroot.org \
--cc=ihor@antonovs.family \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).