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

From: Olivier Brunel <jjk_at_jjacky.com>
Date: Thu, 26 Feb 2015 01:32:53 +0100

On 02/26/15 01:06, Colin Booth wrote:
> 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.

Except that the original environment might either not have a PATH set,
or even possibly an "invalid" one. I don't want to use/keep it, but rely
on the one defined in /path/to/env instead.
I want the environment used to be the one defined in /path/to/env,
without anything from the original one (not even PATH).


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

Well, I don't just want a decorator for log lines. In my case, I want
the logger of a service, an s6-log, to log all lines to a logdir (indeed
/var/log/$service), but also select some specific lines (corresponding
to specific "events") and write them to its stdout as well, which is a
fifo where said lines will be further processed (e.g. exec a script or
something).

But I'd like them prefixed, as multiple loggers (for different services)
will write to that fifo, so it will make things easier to know what line
it is/where it's from.

I suppose I could e.g. use gawk to process log lines, write to the fifo
when needed and always write the log line to its stdout, which would
then go to s6-log to be logged. But I feel a new directive in s6-log
seems a simpler (and more reliable) solution...

Cheers,
-j

>> (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!
>
Received on Thu Feb 26 2015 - 00:32:53 UTC

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