On Sunday 10 August 2003 01:11, Theofilos Intzoglou wrote:
>   It would be nice if the logs that emerge creates were compressed
> with gzip of even better with bzip2. Another nice feature would be to
> automatically erase the old ones. Are these features already
> implemented? The reason I'm asking for these because recently I did a
> du --max-depth=1 -k /var/log/ and I got:
>
> 4       /var/log/news
> 4       /var/log/emerge
> 316     /var/log/cups
> 4       /var/log/mysql
> 272936  /var/log/portage
> 152     /var/log/samba
> 281300  /var/log
>
> 270Megs of log files is kinda too much isn't it? ;-) There were logs of
> emerges done in May in there! For now I'am erasing these manually
> myself but I'd like to find a way to automate it. Thanks!

Well, you can make a script and put it, for example, under /etc/cron.weekly . 
Here is an example copied directly from the 'find' info page:

#---- cut here ----
   Removing old files from `/tmp' is commonly done from `cron':

     find /tmp /var/tmp -not -type d -mtime +3 -print0 |
       xargs --null --no-run-if-empty rm -f

     find /tmp /var/tmp -depth -mindepth 1 -type d -empty -exec rmdir {} \;

   The second `find' command above uses `-depth' so it cleans out empty
directories depth-first, hoping that the parents become empty and can
be removed too.  It uses `-mindepth' to avoid removing `/tmp' itself if
it becomes totally empty.
#---- cut here ----

You could change the lines to remove the files from /var/log/portage instead 
of /tmp and put them under cron.<something> .

For compression you can use something like this:
find /var/log/portage/ -type f -name *.log -exec bzip2 -9q '{}' ';'

If you put it in file under cron.daily your portage log files will be 
compressed once every day (if they are not compressed yet).

These too scripts would probably do what you want: compress the logs and 
remove the old ones.


Cheers,
Renat


P.S. I don't have these scripts in my cron, just created them while writing 
this, but I just compressed my /var/log/portage with bzip and the size went 
down from 83MB to 3MB (with gzip 4MB). Those logs are mostly pretty small, 
there were only few big ones like 17MB for openoffice, 10MB for glibs, etc.


--
[EMAIL PROTECTED] mailing list

Reply via email to