Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Apache: Logging: how-to pipe logs or logtoanothermachine (was Disk



On Sun, 2002-09-08 at 15:24, Jean-Christian Imbeault wrote:
> >From: Viktor Pavlenko <vvp@example.com>
> >
> >  From `man gzip`:
> >
> > >if a file name is "-", the standard input is compressed to the
> > >standard output.
> 
> I just tested it out. Gzip will accept input from  STDIN but won't actually 
> create a file until EOF is sent.
> 
> I did "gzip -cd > t.gz", that create a file called t.gz with 0 bytes, let me 
> type input on the console.
> 
> Nothing was written to the file until I hit Ctrl-D ...

I think your test was not correct. gzip uses (with others) lzw
compression which does not need EOF.
The problem is stdio cache, which "caches" data in memory until a BUFSIZ
data is ready (the same problem would occur with *any* pipe, meaning
that with 2 pipes, you could have a 2*BUFSIZ data somewhere...).
Try with a bigger file, like:
	cat /var/log/messages | gzip [etc...]
If your message file is big enough, gzip will write data block by block.
If you want really to see it in action, do:
	(cat /var/log/messages; cat) | gzip [etc...]
This will send to the input of gzip 1) the message file, and 2) your
input.

Bruno.


-- 
GPG Key: 653514E5 (http://www.raoult.com/gpg)
--
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them
In the land of Mordor where the Shadows lie.

Attachment: signature.asc
Description: This is a digitally signed message part


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links