Re: s6-log problem with +regex

From: Guillermo <>
Date: Thu, 9 May 2019 23:27:19 -0300


El jue., 9 may. 2019 a las 22:03, Dewayne Geraghty escribió:
> 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 this:
> # 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 </tmp/af

> 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
> #!/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

> 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

> PS I haven't made sense of the hyphen in the example, after "E500 - " on
> page

It deselects all lines.

> Testing resulted in
> s6-log: fatal: unrecognized directive: -

Oh? It works for me...

Received on Fri May 10 2019 - 02:27:19 UTC

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