Send stdin to console and compressed file
I'm running a propietary program which generates text output. Kind of like
a logger.
logger
I'd like to both view this output on the terminal to watch the server
breathe, and send it to a text file. So normally I'd do:
logger | tee /tmp/log.txt
But these log files can become large enough to overwhelm my VMs disk
space. Instead of sending the text to an uncompressed text file, I'd like
it to be compressed immediately. So I might do:
logger
in one terminal and
logger | gzip > /tmp/log.gz
in another terminal. But this doesn't feel very *nixy.
Is there a way I can accomplish this in one command, similar to using tee?
Here is what I'm going for, which obviously won't work, but maybe you'll
get the idea:
logger | tee gzip > /tmp/log.txt
No comments:
Post a Comment