From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2575 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Laurent Bercot" Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: s6-log problem with +regex Date: Fri, 10 May 2019 02:38:14 +0000 Message-ID: References: <1fd4f712-f743-68ff-f648-151004ecfb0b@heuristicsystems.com.au> Reply-To: "Laurent Bercot" Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="131356"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: eM_Client/7.2.34711.0 To: "Dewayne Geraghty" , supervision@list.skarnet.org Original-X-From: supervision-return-2165-gcsg-supervision=m.gmane.org@list.skarnet.org Fri May 10 04:37:12 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 1hOvPK-000Y1q-TX for gcsg-supervision@m.gmane.org; Fri, 10 May 2019 04:37:10 +0200 Original-Received: (qmail 2988 invoked by uid 89); 10 May 2019 02:37:36 -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 2981 invoked from network); 10 May 2019 02:37:36 -0000 In-Reply-To: <1fd4f712-f743-68ff-f648-151004ecfb0b@heuristicsystems.com.au> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2575 Archived-At: >Thank-you for s6-rc and friends. I came across two items: >1. the s6-log in testing requires a control directive. In my testing >without a T, t, n $VALUE for example, the s6-log command failed. "s6-log 1", which does nothing but send stdin straight through to stdout, works for me on both Linux and FreeBSD. 1 is an action directive. So, I cannot reproduce what you're reporting here. >2. The regular expression preceded by a + unintentionally matches >everything, which was surprising as I intended to maintain separate logs > which emanated from the same process (apache24) I can absolutely reproduce what you're reporting here, but the match is intentional. :) By default, every line is selected; if you want to do a positive matching, you have to first deselect everything: >#!/usr/local/bin/execlineb -P ; # The testing script >redirfd -r 0 /tmp/af >/usr/local/bin/s6-log -b n3 +^\\\[ /tmp/date-only f s100 S1500 T >/tmp/default Your +^\[ regular expression does nothing here because every line is already selected, so everything goes into /tmp/default. A "-" directive before the "+^\\\[" directive should deselect every line, and then your matching expression will work as you intend. >The platform is amd64 FreeBSD 11.2Stable built May 6, clang v7.0.0 and >clang 8.0.0 That is not a factor in the problem above. However, it *is* a factor in the following issue: >PS I haven't made sense of the hyphen in the example, after "E500 - " on >page https://www.skarnet.org/software/s6/s6-log.html. Testing resulted in >s6-log: fatal: unrecognized directive: - Now that is interesting. It appears that the BSD libc's regcomp() does not support empty regular expressions: the directive "-" fails with that error message on FreeBSD, OpenBSD and NetBSD. Whereas on Linux (with either musl or glibc), an empty regular expression is accepted by regcomp() and treated as always matching. So, you found a portability problem; thanks for the report. I will patch s6-log so that an empty regular expression is recognized even on the BSDs - so "-" will always deselect everything and "+" will always select everything. In the meantime, on Free/Open/NetBSD (and likely Darwin too), please use "-.*" as a way to deselect every line at the beginning of a s6-log script. -- Laurent