supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Brett Neumeier <bneumeier@gmail.com>
To: Laurent Bercot <ska-supervision@skarnet.org>
Cc: "supervision@list.skarnet.org" <supervision@list.skarnet.org>
Subject: Re: A better method than daisy-chaining logging files?
Date: Fri, 31 May 2019 07:52:08 -0500	[thread overview]
Message-ID: <CAGSetNuDw_Uy_2x-r-Oj4XGEXbeBzg5vg0dH0y-pC4_OU+Lgbw@mail.gmail.com> (raw)
In-Reply-To: <em7988d39c-b7f1-4c41-8413-be91240e0c52@elzian>

[-- Attachment #1: Type: text/plain, Size: 2256 bytes --]

On Fri, May 31, 2019 at 4:21 AM Laurent Bercot <ska-supervision@skarnet.org>
wrote:

> >I just attempted to link an apache24 instance to its log files via a
> >bundle, which isn't acceptable to s6-rc-compile.
> My advice is to use s6-rc's producer/consumer mechanism for one
> of the log streams, and use a named pipe for the other one, without
> cramming it into the s6-rc mechanism. That would typically mean:
>
> - configure apache24 to output its access log to stdout
> - declare apache24 as a producer for apache24-access-log and
> apache24-access-log as a consumer for apache24
> - apache24-access-log is a simple s6-log invocation, reading
> from its stdin
> - mkfifo /var/run/apache24/error-fifo (with appropriate rights)
> - declare that apache24 outputs its error log to
> /var/run/apache24/error-fifo
> - apache24-error-log has its run script doing something like:
> redirfd -r 0 /var/run/apache24/error-fifo s6-log your-logging-script
> - manually list apache24-error-log in apache24's dependencies, so
> apache24 doesn't start before apache24-error-log. (The pipeline
> mechanism automatically adds apache24-access-log to apache24's deps.)
> - manually define any bundles you want.
>

For what it's worth, I use approximately this setup on my s6- and
s6-rc-managed nginx server. The only difference is that I have nginx using
/dev/stdout as its _error_ stream; and then I have a service that creates a
separate fifo for each site defined in the nginx configuration. Nginx
writes each access log to the appropriate fifo, and there's a separate
s6-log process consuming from each of the fifos. I have had no problems
whatever with that setup, it works like a charm and was really pretty
straightforward to set up.

In fact, I find that there are a lot of services I want to run that can
either log to syslog or write to a specific filesystem location, and the
same "service writes to a fifo, s6-log reads from the fifo" mechanism works
fine for all of them. Since I use that pattern so frequently, I create a
`/run/log-fifos` directory to contain all the fifos. I think that makes the
entire mechanism pretty obvious and transparent, which is my general goal
with system administration.

Cheers,

Brett

-- 
Brett Neumeier (bneumeier@gmail.com)

  reply	other threads:[~2019-05-31 12:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  5:24 Dewayne Geraghty
2019-05-31  9:22 ` Laurent Bercot
2019-05-31 12:52   ` Brett Neumeier [this message]
2019-06-17  6:25     ` Dewayne Geraghty
2019-06-17 17:58       ` Laurent Bercot
2019-06-17 22:15         ` Dewayne Geraghty
2019-06-18  6:35           ` Laurent Bercot
2019-06-18  7:27             ` Dewayne Geraghty
2019-06-18  7:26         ` Joan Picanyol i Puig
2019-06-18  7:48           ` Dewayne Geraghty
2019-06-18 20:52             ` Joan Picanyol i Puig
2019-06-19  7:05               ` Dewayne Geraghty
2019-06-20  6:09                 ` Laurent Bercot
2019-06-18  7:53           ` Dewayne Geraghty

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=CAGSetNuDw_Uy_2x-r-Oj4XGEXbeBzg5vg0dH0y-pC4_OU+Lgbw@mail.gmail.com \
    --to=bneumeier@gmail.com \
    --cc=ska-supervision@skarnet.org \
    --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).