You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Agnello George <ag...@gmail.com> on 2008/06/05 08:01:25 UTC

[users@httpd] log roatation / delete for virtual domains

HI

I have atleast 20 virtual host on my Apache ( 2.2.8 ) server and am having
a difficulty in deleting the logs after it reaches a certain limit.
my vhost directive look something like this :

<VirtualHost 192.168.0.244:80>
ServerAdmin admin@agnello.sys.qualiproj.com
ServerName agnello.sys.qualiproj.qualispace.com
ServerAlias www.agnello.sys.qualiproj.qualispace.com
DocumentRoot /websites/agnello.com/web
ErrorLog /websites/agnello.com/logs/agnello.sys.qualiproj.error_log
CustomLog /websites/agnello.com/logs/agnello.sys.qualiproj.access_logcombined
TransferLog "|/usr/local/apache2/bin/rotatelogs /websites/
agnello.com/logs/agnello.sys.qualiproj.access_log 5M"
TransferLog "|/usr/local/apache2/bin/rotatelogs /websites/
agnello.com/logs/agnello.sys.qualiproj.error_log 5M"
</VirtualHost>


Is it possible to delete the logs ( with Apache's rotatelog command ) after
the log file  reaches a certain size limit.

thanks

-- 
Regards
Agnello Dsouza
www.linux-vashi.blogspot.com

Re: [users@httpd] log roatation / delete for virtual domains

Posted by Agnello George <ag...@gmail.com>.
On 6/5/08, André Warnier <aw...@ice-sa.com> wrote:

> Or you could change your log rotation system altogether, and use logrotate
> if your OS has it.
> The general idea is : you dom't use rotatelogs, you write the logs normally
> to a file.
> With cron, you regularly run logrotate, as often as you want.
> It has a configuration file that tells it which files to rotate, how often,
> in function of which criteria, what to do before and after the rotation, how
> many "back-copies" to keep before starting to overwrite them etc..  It does
> this cleanly and without necessarily interrupting the process whose files it
> is rotating.
> "man logrotate" under Linux is pretty explicit.


But the thing is  i have virtual domains currently 20 and will increase to
100 in the next month .... i would have to manually  edit the logrotate.conf
file ( /etc/logrotate.conf ) which wd be a lot time consuming for say 100 +
domains  . my log files for each domain is located as such : /websites/
domain.com/logs/doamin.com_access_log. Currently i am using apache's
rotatelog command and it allow to set a max size to your log and rotate it
but doesn't delete old logs files. Is it possible to write a script in the
httpd-vhost.conf file to delete logs after it reaches certain time frame
!!!

-- 
Regards
Agnello Dsouza
www.linux-vashi.blogspot.com
www.bible-study-india.blogspot.com

Re: [users@httpd] log roatation / delete for virtual domains

Posted by André Warnier <aw...@ice-sa.com>.
Or you could change your log rotation system altogether, and use 
logrotate if your OS has it.
The general idea is : you dom't use rotatelogs, you write the logs 
normally to a file.
With cron, you regularly run logrotate, as often as you want.
It has a configuration file that tells it which files to rotate, how 
often, in function of which criteria, what to do before and after the 
rotation, how many "back-copies" to keep before starting to overwrite 
them etc..  It does this cleanly and without necessarily interrupting 
the process whose files it is rotating.
"man logrotate" under Linux is pretty explicit.


Ben Ricker wrote:
> Rotatelogs, as far as I know, does not delete logs. It merely rotates 
> them. If you want to delete for size, you could do some fancy work with 
> 'ls', cut out the size, compare it to a specific number you want, and 
> then delete it if it is over that size.
> 
> That seems kludgy though. What I do is use find on the directory and use 
> -ctime +N where 'N' is the number of days you want logs to stick around. 
> Then you can pipe it through |xargs rm -f. This will delete any logs 
> that have been around since N days after creation.
> 
> --Thanks,
> 
> Ben Ricker
> 
> --------------
> 
> I use my cat's name for a password: he is called zo4W*!@n32G+ and I 
> change his name every 60 days.
> 
> 
> 
> On Jun 5, 2008, at 1:01 AM, Agnello George wrote:
> 
>> HI
>>
>> I have atleast 20 virtual host on my Apache ( 2.2.8 ) server and am 
>> having a difficulty in deleting the logs after it reaches a certain 
>> limit.
>> my vhost directive look something like this :
>> <VirtualHost 192.168.0.244:80>
>> ServerAdmin admin@agnello.sys.qualiproj.com
>> ServerName agnello.sys.qualiproj.qualispace.com
>> ServerAlias www.agnello.sys.qualiproj.qualispace.com
>> DocumentRoot /websites/agnello.com/web
>> ErrorLog /websites/agnello.com/logs/agnello.sys.qualiproj.error_log
>> CustomLog /websites/agnello.com/logs/agnello.sys.qualiproj.access_log 
>> combined
>> TransferLog "|/usr/local/apache2/bin/rotatelogs 
>> /websites/agnello.com/logs/agnello.sys.qualiproj.access_log 5M"
>> TransferLog "|/usr/local/apache2/bin/rotatelogs 
>> /websites/agnello.com/logs/agnello.sys.qualiproj.error_log 5M"
>>
>> </VirtualHost>
>>
>>
>> Is it possible to delete the logs ( with Apache's rotatelog command ) 
>> after the log file  reaches a certain size limit.
>>
>> thanks
>>
>> --Regards
>> Agnello Dsouza
>> www.linux-vashi.blogspot.com
>>
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] log roatation / delete for virtual domains

Posted by Ben Ricker <be...@gmail.com>.
Rotatelogs, as far as I know, does not delete logs. It merely rotates  
them. If you want to delete for size, you could do some fancy work  
with 'ls', cut out the size, compare it to a specific number you want,  
and then delete it if it is over that size.

That seems kludgy though. What I do is use find on the directory and  
use -ctime +N where 'N' is the number of days you want logs to stick  
around. Then you can pipe it through |xargs rm -f. This will delete  
any logs that have been around since N days after creation.

-- 
Thanks,

Ben Ricker

--------------

I use my cat's name for a password: he is called zo4W*!@n32G+ and I  
change his name every 60 days.



On Jun 5, 2008, at 1:01 AM, Agnello George wrote:

> HI
>
> I have atleast 20 virtual host on my Apache ( 2.2.8 ) server and am  
> having a difficulty in deleting the logs after it reaches a certain  
> limit.
> my vhost directive look something like this :
> <VirtualHost 192.168.0.244:80>
> ServerAdmin admin@agnello.sys.qualiproj.com
> ServerName agnello.sys.qualiproj.qualispace.com
> ServerAlias www.agnello.sys.qualiproj.qualispace.com
> DocumentRoot /websites/agnello.com/web
> ErrorLog /websites/agnello.com/logs/agnello.sys.qualiproj.error_log
> CustomLog /websites/agnello.com/logs/ 
> agnello.sys.qualiproj.access_log combined
> TransferLog "|/usr/local/apache2/bin/rotatelogs /websites/ 
> agnello.com/logs/agnello.sys.qualiproj.access_log 5M"
> TransferLog "|/usr/local/apache2/bin/rotatelogs /websites/ 
> agnello.com/logs/agnello.sys.qualiproj.error_log 5M"
>
> </VirtualHost>
>
>
> Is it possible to delete the logs ( with Apache's rotatelog  
> command ) after the log file  reaches a certain size limit.
>
> thanks
>
> -- 
> Regards
> Agnello Dsouza
> www.linux-vashi.blogspot.com
>