From: Joan Picanyol i Puig <lists-supervision@biaix.org>
To: supervision@list.skarnet.org
Subject: Re: multiple log streams
Date: Wed, 23 Sep 2009 16:20:18 +0200 [thread overview]
Message-ID: <20090923142018.GE34137@grummit.biaix.org> (raw)
In-Reply-To: <20090903213444.GA25163@skarnet.org>
* Laurent Bercot <ska-supervision@skarnet.org> [20090903 23:33]:
> > Assuming producer & consumer are supervise/runsv managed services, how
> > do I reliably handle producer's log rotation?
>
> Why do you even use multilog/svlogd, since you have written your own
> logging facility ?
> Make your consumer just read from stdin and log reliably to the
> multiple places you need; and have it run as a logger for the producer,
> in /service/producer/log/run. You won't have to deal with multilog/
> svlogd's rotation.
I have multiple consumers, some real-time and some batch. I need to be
able to easily adapt to more consumers appearing. Batch consumers are
handled at rotation time, real-time must feed from current. In case of >
1 real-time consumers, I should be able to get by with multitee.
> > My consumer opens /service/producer/log/main/current and gets signaled
> > by producer/log upon rotation. My consumer main loop yields every
> > iteration (say, by sleeping every 10ms), and its signal handler for log
> > rotation sets a global flag. When set, it reads until EOF on
> > log/main/current 's fd, closes it and reopens it. So far so good (please
> > correct me if I'm wrong).
>
> Um, I don't quite get what you're doing, but it sounds like your consumer
> is performing active waiting.
I do usleep() every iteration, which does not count as active waiting in
my book. I'm not handling EINTR (I just keep reading until EOF &&
signaled).
> Don't: use a select()/poll()/iopause() loop
> listening on stdin, with a long - perhaps infinite - timeout.
> If you need to trap signals, use the self-pipe trick.
> http://www.skarnet.org/skalibs/selfpipe.html
Yep, that's definitely The Right Way.
tks
--
pica
next prev parent reply other threads:[~2009-09-23 14:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-02 8:47 Joan Picanyol i Puig
2009-04-02 8:57 ` Alex Efros
2009-04-02 9:24 ` Joan Picanyol i Puig
2009-04-02 9:47 ` Alex Efros
2009-04-02 13:47 ` Joan Picanyol i Puig
2009-04-03 8:19 ` Laurent Bercot
2009-09-03 9:02 ` Joan Picanyol i Puig
2009-09-03 21:34 ` Laurent Bercot
2009-09-03 22:35 ` Charlie Brady
2009-09-04 7:51 ` Laurent Bercot
2009-09-23 14:20 ` Joan Picanyol i Puig [this message]
2009-09-25 20:45 ` 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=20090923142018.GE34137@grummit.biaix.org \
--to=lists-supervision@biaix.org \
--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).