s6-log problem with +regex

From: Dewayne Geraghty <dewayne.geraghty_at_heuristicsystems.com.au>
Date: Fri, 10 May 2019 11:02:17 +1000

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.
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)

So to testing. 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. Unfortunately the selection mechanism failed and the entire
content of the test file (/tmp/af) was duplicated, ie unselectively.

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

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

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.

The platform is amd64 FreeBSD 11.2Stable built May 6, clang v7.0.0 and
clang 8.0.0

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: -
Received on Fri May 10 2019 - 01:02:17 UTC

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