Re: s6 problems logging

From: Colin Booth <colin_at_heliocat.net>
Date: Sun, 27 Jan 2019 18:13:52 +0000

On Sun, Jan 27, 2019 at 11:47:51AM -0500, Sean MacLennan wrote:
> On Sun, 27 Jan 2019 05:20:00 +0000
> Colin Booth <colin_at_heliocat.net> wrote:
>
> > Everything looks fine from over here. Does running doorknob with -fs
> > from the terminal do what you expect?
>
> Yup, I get a log message to the console when I send an email.
>
> > Also, what does
> > `s6-svstat PATH_TO_DOORKNOB_SVCDIR' and
> > `s6-svstat PATH_TO_DOORKNOB_SVCDIR/log'
> > tell you?
>
> /service/doorknob# /command/s6-svstat .
> up (pid 948) 47861 seconds
> /service/doorknob# /command/s6-svstat log
> up (pid 847) 75815 seconds
>
> Log has been up longer because I restarted doorknob with an s6-svc
> down/up. Not sure if this is kosher with logging. Is there a
> recommended way to start/stop services that have logging?
>
That should be fine. The only requirement that I know of is that you
re-register the service directory if you add or remove a log/ dir since
the presence or absence of a log/ directory is only checked when
s6-svscan first checks the directory. Reregistration in this case means:
delete the symlink, run s6-svscanctl -an, confirm that the removed
service has exited, create the symlink, and re-run s6-svscanctl -an.

Downing a logger may or may not cause problems, depending on how many
messages your service sends. Not because you'll lose stuff, but because
the service will block eventually as it tries to write to a pipe that
isn't being drained.
> > Also, does the target dir for s6-log have the files
> > "current" (apparently not), "lock", and "state"? Those final two
> > files are created by s6-log automatically and should at least
> > indicate that it's starting up fine.
>
> /service/doorknob# ls log
> current event lock run state supervise
>
> So it does have all the files/directories but current is empty even
> though there should be some log entries.
>
Cool, that means everything can write correctly.
>
> I do use s6-log in one other service and it works. In the
> service/s6-svscan-log I have:
>
> #!/command/execlineb -P
> cat ./fifo
>
> And the same log/run as doorknob.
>
> Cheers,
> Sean
As Laurent mentioned, it sounds like your service isn't terminating its
lines correctly. The other option is that you're writing your messages
to stderr instead of stdout (in which case you'd end up on the
catch-all logger unless you did `fdmove -c 2 1' in your doorknob script
before starting doorknob itself. That said, it's unlikely, since vprintf
seems to wite to stdout unless you tell it otherwise.

-- 
Colin Booth
Received on Sun Jan 27 2019 - 18:13:52 UTC

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