Re: single instance of multilog for multiple processes
Richard Lucassen <[email protected]> Mon, 21 Sep 2009 15:47:20 +0200
| Newsgroups | gmane.comp.djb.syslog |
|---|---|
| Organization | XAQ Systems |
| Message-ID | <[email protected]> |
On Mon, 21 Sep 2009 22:34:04 +0930 Daryl Tester <[email protected]> wrote: > > "man fifo" is not clear enough about this matter. The question is: > > where is the limit? Is it a block of 4096 bytes? > > There are two limits as such - one is PIPE_BUF, which under Linux > (well, the one I'm running) is defined in <linux/limits.h> as 4096 > characters. The other limit is more of an issue than limit - the > write() to pipe has to be atomic. In my aforementioned issue I had > some concurrent shell scripts being supervised. Despite preformatting > the print strings to echo as one entire quoted string, strace showed > bash was splitting up the writes and thus allowing other log messages > to get interleaved. I solved the problem by not using bash :-/. Ok, so a few "run" scripts containing: exec 1>/path/to/fifo exec 2>/path/to/fifo should work well, depending on the "atomicness" of the writing processes. > > I just write lines no longer than let's say 80 to 100 charachters > > (including the timestamp) so I presume there will be no problem. > > So long as you write it in one operation then it shouldn't be > an issue e.g. if under C - > > /* Note cunning ignorance of return value */ > write(1, "hi there\n", strlen("hi there\n")); > > If you split the string into several writes, that's when the > opportunity for mischief arises. ack > > And how would you merge two outputs from two separate multilog > > processes into file. Using a postprocessor? > > If you have timestamps, then man (1) sort is your friend. I know. But "tail -F current" doesn't work. I use these logs not for "watching what has happened" but for "follow what happens". And as there are 4 processes involved I'd like to keep them together in 1 log. You can ask "why not write to syslog?". Well, in that case I would never have subscribed to this list ;-) > > I could also use "setlock" to lock the fifo for writing. > > That would work, but then it wouldn't be concurrent ... But finally it resolves the problem ;-) But OTOH, not in case of an "exec 1>fifo" construction :( > > And > > And? Therefore? Nevertheless? But? :-) oops... :-) -- ___________________________________________________________________ It is better to remain silent and be thought a fool, than to speak aloud and remove all doubt. +------------------------------------------------------------------+ | Richard Lucassen, Utrecht | | Public key and email address: | | http://www.lucassen.org/mail-pubkey.html | +------------------------------------------------------------------+