supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Dewayne Geraghty <dewayne.geraghty@heuristicsystems.com.au>
To: supervision@list.skarnet.org
Subject: s6-log problem with +regex
Date: Fri, 10 May 2019 11:02:17 +1000	[thread overview]
Message-ID: <1fd4f712-f743-68ff-f648-151004ecfb0b@heuristicsystems.com.au> (raw)

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: -


             reply	other threads:[~2019-05-10  1:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10  1:02 Dewayne Geraghty [this message]
2019-05-10  2:27 ` Guillermo
2019-05-10  2:38 ` Laurent Bercot
2019-05-10  4:52   ` Dewayne Geraghty
2019-05-10 14:23     ` Laurent Bercot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1fd4f712-f743-68ff-f648-151004ecfb0b@heuristicsystems.com.au \
    --to=dewayne.geraghty@heuristicsystems.com.au \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).