Re: Some wishes for s6-log & s6-envdir

From: Colin Booth <cathexis_at_gmail.com>
Date: Wed, 25 Feb 2015 16:06:00 -0800

On Wed, Feb 25, 2015 at 3:06 PM, Olivier Brunel <jjk_at_jjacky.com> wrote:
> Hi,
>
> Sorry, no bug reports; Couple of feature wishes though :p
>
> E.g. I have a script that I need to run, but I don't know what the
> original environment is. Right now I have it start with:
> /bin/emptyenv /bin/s6-envdir /path/to/env /bin/exec
>
> That to ensure everything else runs with the environment I want, when
> the original one could even have an "invalid" PATH. With both options, I
> could reduce it to a simple e.g:
> /bin/s6-envdir -c -p /path/to/env
>
/bin/emptyenv -p s6-envdir /path/to/env exec
should be good enough. It's still an extra command over what you're
looking for, but as long as you don't flush the PATH environment
variable, you should know what you have coming.
>
>
> - s6-log: I'd like a control directive to set a prefix, that would be
> printed before the actual log line. E.g. with
> p "s6-log: alert: " 1
>
> One would get the same as 2 only on stdout. Not that that is very
> useful, but I have a few loggers that can send some lines to a fifo for
> them to be processed, and such a prefix would allow me to e.g. specify
> the service name before the log line (as well as a simpler way to ID the
> event, to save parsing the line again).
>
That's doable now using stdin/stdout editors. For example, the
reference syslog replacement runs s6-ipcserver that spins up
ucspilogd's to catch each type of message going through /dev/log.
Doing this for any service probably involves having your service log
to a fifo instead of s6-log, then writing a log decorator service that
reads that fifo, decorates it with your prefixes, and then passes it
along to s6-log for management. Generally speaking though, it's easier
on the brain to output to /$logdir/$servicename instead of having to
look inside of the files for information.
>
> (In fact, I could even do with a directive so only the "prefix" is used
> (written to stdout), without the actual log line, so when specific lines
> are selected, only a pre-defined text is used/written to 1, since that's
> all I would need... but a prefix is good enough.)
>
>
> Regards,
> -j
I'm not trying to imply that these are bad suggestions (they aren't),
but that I'm pretty sure that the stuff that you're asking for is
already available with a few support scripts pretending to be
services.

Cheers!

-- 
"If the doors of perception were cleansed every thing would appear to
man as it is, infinite. For man has closed himself up, till he sees
all things thru' narrow chinks of his cavern."
  --  William Blake
Received on Thu Feb 26 2015 - 00:06:00 UTC

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