From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2574 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Guillermo Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: s6-log problem with +regex Date: Thu, 9 May 2019 23:27:19 -0300 Message-ID: References: <1fd4f712-f743-68ff-f648-151004ecfb0b@heuristicsystems.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="87722"; mail-complaints-to="usenet@blaine.gmane.org" To: Supervision Original-X-From: supervision-return-2164-gcsg-supervision=m.gmane.org@list.skarnet.org Fri May 10 04:27:34 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 1hOvG1-000Mix-JC for gcsg-supervision@m.gmane.org; Fri, 10 May 2019 04:27:33 +0200 Original-Received: (qmail 2555 invoked by uid 89); 10 May 2019 02:27:58 -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 2548 invoked from network); 10 May 2019 02:27:57 -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 :content-transfer-encoding; bh=AjMbU3P9WzsOFEwdjgzHbXBVtoUmsvjrqqIDNTfrCZY=; b=BCTgq2UvsuAmTf0ywgtkTIfI4vdi9BwCNLjzYYyvPsikHkd0CD2bwhelMoy5+CbMx/ qELw5w/CCetKJMeNO1Dqk2ppR7tdjkvlvTqL2j8G6Geeq2uVrMujx10wihj0N+EHqF5E Hela6n0WXuPUb9PjYfX34uN0qgp2xpaQBU7ACaNs+kpiCkfnCZHndXD5YP345BKR4q2N 41c0LRkvyiCXYK+1GZcwllltvPpJSEeK+M6ql6hOXGwJRWsEyYw9ODn1WpwaTuxy571e 4yfjWyn6p/DI5hfmtq1/B4is3OQpl9U0JKS0PaPgsoIinuPUvKQcvPMEi5TDrGAqTaXb 5//w== 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:content-transfer-encoding; bh=AjMbU3P9WzsOFEwdjgzHbXBVtoUmsvjrqqIDNTfrCZY=; b=XNHAeyuA5oCWcIO4dvmpTANDhsYnxMXIVc8bsGmAzx1W2litwlSkm5ViN6Qy41GSB3 Fder9wq2tCaeBJ1ZLsYYrPXT8E2vCD/2n+izgtZ4r0z8yFokAcmwayUA6UQor1oIZHJ4 kAxjd1vuBPrR+8FbYkp2M9WIgjsm593hNLptwd8RdILTiPYphro+BU2EvrXQIyCP+zzO xb7x8XAmJQwGU2mrFY5y9baUBLndnFZiTdTqBhCwqn8dHjkfGazM+xWD0OdBKMce9TmB iUx561lVeaysFnDXorro0948PoyKIGsNt4HlKSNfQkHZ+fXMnTg/Cfhn8ecLNKTdpXTR aUow== X-Gm-Message-State: APjAAAUO08rBHsWP0YpF3xYoRwMpgroHC7lvj+QrlUChVdoQJH4ctYVB cr2Vej+Sl+C8R9WdS8FeJE3Hx3fI5NUsJjR1r19nxQ== X-Google-Smtp-Source: APXvYqzYsZpUInQa3tA3OLUBqR/87aIy5ytnhfULVaHxvy6YlUxATJpSZIkiuSuCl6xJTEMVyHSiF24tJRoYQ0A3z68= X-Received: by 2002:a24:8d04:: with SMTP id w4mr5771640itd.161.1557455249681; Thu, 09 May 2019 19:27:29 -0700 (PDT) In-Reply-To: <1fd4f712-f743-68ff-f648-151004ecfb0b@heuristicsystems.com.au> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2574 Archived-At: Hi, El jue., 9 may. 2019 a las 22:03, Dewayne Geraghty escribi=C3=B3: > > My test comprised an input /tmp/af with the intention of > four separate s6-log managed logdirs. The logdirs' structure was > correctly created, however three contained the same content, and the > default contained nothing. So the reduced form of testing looks like thi= s: > # cat /tmp/af # a file of text to be processed > a line of text not selected > b nother line of text > c more lines > [date] with line of text > > The intention is to create a separate log based on a regex of the first > character. Did you want something like this (in shell)? /usr/local/bin/s6-log - +^a /tmp/a-only - +^b /tmp/b-only - +^c /tmp/c-only - +^\\\[ /tmp/date-only - f /tmp/default The following places the content of /tmp/af into /tmp/date-only. > > #!/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 Yes, because at the beginning of directive processing, all input lines are implicitly selected. Therefore, a '+' directive does nothing if there aren't any '-' directives preceding it that deselect something: anything it selects is already selected. > The following works correctly, in that date-only does not contain the > [date] line. It does contain the rest of /tmp/af, while /tmp/default > does contain only the date (input line). > > # cat s6-test.sh > #!/usr/local/bin/execlineb -P > redirfd -r 0 /tmp/af > /usr/local/bin/s6-log -b n3 -^\\\[ /tmp/date-only f s100 S1500 T > /tmp/default Yes, because at the beginning of directive processing, all input lines are implicitly selected, and then the '-' directive deselects those that start with '[', so /tmp/date-only contains everything except those lines. The 'f' directive selects lines that start with '[', because, quoting the documentation, those are the ones "that have not yet been acted upon (i.e. that were always deselected when the script encountered an action directive)", so /tmp/default contains only them. The "action directive" that "acts upon" the other lines in this context is '/tmp/date-only' (an automatically rotated logdir directive). > Incidentally using the s6-log command > /usr/local/bin/s6-log -b n3 +^\\\[ /tmp/date-only s10 S150 T +^b > /tmp/b-only f s100 S1500 T /tmp/default > results in both > /tmp/date-only/current and /tmp/b-only/current > containing all of /tmp/af, /tmp/default had the expected structure but > empty current file. Yes, same as the first example. '+' directives that aren't preceded by '-' directives that deselect something do nothing, therefore /tmp/date-only and /tmp/b-only are copies of /tmp/af. And because there are no lines "that have not yet been acted upon" (all of them have been "acted upon" by the '/tmp/date-only' and '/tmp/b-only' directives), the 'f' directive selects nothing and /tmp/default is empty. > 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. It deselects all lines. > Testing resulted in > s6-log: fatal: unrecognized directive: - Oh? It works for me... G.