From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2628 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Brett Neumeier Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: A better method than daisy-chaining logging files? Date: Fri, 31 May 2019 07:52:08 -0500 Message-ID: References: <16c909e2-9b84-63c8-7c60-380befe28f01@heuristicsystems.com.au> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003912ed058a2e7cfb" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="110108"; mail-complaints-to="usenet@blaine.gmane.org" Cc: "supervision@list.skarnet.org" To: Laurent Bercot Original-X-From: supervision-return-2218-gcsg-supervision=m.gmane.org@list.skarnet.org Fri May 31 14:52:26 2019 Return-path: Envelope-to: gcsg-supervision@m.gmane.org Original-Received: from alyss.skarnet.org ([95.142.172.232]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hWh1G-000SXD-3D for gcsg-supervision@m.gmane.org; Fri, 31 May 2019 14:52:26 +0200 Original-Received: (qmail 31865 invoked by uid 89); 31 May 2019 12:52:49 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Original-Received: (qmail 31858 invoked from network); 31 May 2019 12:52:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=evC2oXYPtxbrfgDdq3AkRR31g5+IHG+uewUfqyQjZEk=; b=lAtFyx7IG59YA5PDPnynZwG62+PAm5rFX8+qnw0Ok9zGgVqAofZ1u3tvJGOEGKYWga LdjpRLzJyBw1ix1KVsB3aJkD4KD/jWHtYmjlV1qre50MtFg1AmXyZFwv4qfcGoiOHoHW oEmaBzlCTMdn8ZsQMJQUOfkbYf0iX9iQhVVDmCILwghlJurGXWK9gzAl5tJzBqaQfT1v UtRcgQdZYelpHgN33BhEw7YwFHth/AYZxTAa1sYRD0WNYkNYgKtRcIqlWDLR79a+6ED6 lvjuNzNFMj1XVL9TqJphmYdnKHuJ9KPFPOnvX84qMepgJnOGhRb6PPp7yBHCCqFVAncD QwYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=evC2oXYPtxbrfgDdq3AkRR31g5+IHG+uewUfqyQjZEk=; b=rQrUToiPCHmKggh+FB2WsLsBlxvBG2GyMFcSIAaeP8dHbP+nCmDagju3UlBkyx+S1u MV+8M1/hdsPNI12GR7WM0ft/dTemnt+Qa2CNrwPNrgpvTSQO+V8Eu1FW+LuKvmeDYUda JpVC4ixrmC34T4ScBKAdQewS6jBPJ3kS7nMYvdBeJo0U8OPjXuG4Ubn4ykujCQmQJwEk K2UHJz2VOF5UnfIJFAEcUxWWP6xlpzwlMQmXdnqNabN7cYt15tWqdol8Sg1JEHAroSn7 Xwjvze7W0IuAINo4QlxW0ORCoX+hEgw89bRzEmJkhk4AM8r+1ib1lvw1/CZFTBd86wuj j0VQ== X-Gm-Message-State: APjAAAVS5v2nPq+tqIxcRTv0mO0fE5gUHgADvGvD/sa3Gm5gidnRFVJ2 kl7S1mM2jzK0zBss8rM2LNJPmLJZz8ZliwsxPek= X-Google-Smtp-Source: APXvYqynqKeyU2NLMiWWUzVTJX29O5jDToUcrIYylMw03okxokZjwC/Y7F7nQF2FD5Z3ZpWo1UCn4uX9SEBNkFaSEYA= X-Received: by 2002:a37:5945:: with SMTP id n66mr8247306qkb.295.1559307140795; Fri, 31 May 2019 05:52:20 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2628 Archived-At: --0000000000003912ed058a2e7cfb Content-Type: text/plain; charset="UTF-8" On Fri, May 31, 2019 at 4:21 AM Laurent Bercot 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) --0000000000003912ed058a2e7cfb--