Re: Logging in a web server context

From: Laurent Bercot <ska-supervision_at_skarnet.org>
Date: Sat, 13 Jun 2020 12:53:00 +0000

  Add-on: Jan suggested to run the service with only *one* output channel
in order to benefit from the reliable pipe integration feature in s6,
and do to the dispatching into different service directories at the
s6-log level.

  I'm generally not a fan of fan-in fan-out mechanisms (pun unintended),
because it's a lot easier to mix data than to triage it, so if data
streams are separated early, mixing them to transmit them over one
channel then parsing the data to separate it into several streams again
is wasteful. Having the ability to keep service-specific log stream
rather than conflating everything into a global logger is one of the
big advantages of the s6 logging infrastructure over the syslog model.

  However, in this precise case, until s6(-rc) provides tools to
cleanly and reliably handle several output channels for a service, it
may be worth considering the option, just to make the installation
easier.
  - prefix the stdout log lines with something easily recognizable
  - prefix the stderr log lines with something easily recognizable, and
obviously different
  - direct both streams to the service's stdout
  - use the s6 logger feature that will maintain a pipe for you
  - in your s6-log script, parse your log lines and direct them to
different logdirs depending on the prefix they have. If you chose
easily differentiable prefixes, it shouldn't even take any noticeable
CPU time.

--
  Laurent
Received on Sat Jun 13 2020 - 12:53:00 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC