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

Re: Apache and rotating Logs (for each VHost)



On 12.08.06 16:35, Michelle Konzack wrote:
> As I was running only about 30-40 VHosts it was realy easy to
> rotate the two logs (error and access) for each VHost...  
> 
> Now I run into trouble rotation daily logs because it needs to much time
> to rotate.  OK, I have tried to rename (!) the log with since
> 
>     rename s/access/${DATE}-acc/ $USER/log/apache/access.log
> 
> leafe the FD open and not like
> 
>     mv -f $USER/log/apache/access.log $USER/log/apache/${DATE}-acc.log
> 
> where the FD goes into the nirvana and I lost LOG data. Then after
> rotating 8000 logs I have reloaded "apache" and the compressed all
> logs.

try to learn how unix files work. The file is represented by inode - it
stays open even after being renamed, removed or moved (in the same
filesystem). So you need (gracefully) reload apache to reopen log files not
to loose data.

>     It takes more then 9 minutes (rot.) + 40 minutes (comp.)
>     for arround 5 GByte of logs!!!

closing and opening of 8000 files of course takes time...
not talking about compressing that much of data

> Any suggestions how to do effectiv logrotation for apache?

use only one logfile for all vhosts, and if you need to split it, do it
after rotation (and before compression, of course). 

I do the same. I have some thousands of vhosts, but only few of them really
need logfiles. You only need to have '%v' in your logformat (canonical name
of the vhost called) for correct splitting of logs.

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Micro$oft random number generator: 0, 0, 0, 4.33e+67, 0, 0, 0...



Reply to: