Re: logrotate for multiple websites

2010-03-04 Thread Olaf Reitmaier Veracierta

On 01/03/10 17:13, Richard Hector wrote:

Hi all,

I understand that I can setup a logrotate entry with sharedscripts, so
it will only reload apache once for all the logs in that stanza.

That's fine, until you want to have multiple stanzas.
   
Well, it true you can't reload apache per virtualhost (site) basis, but 
is not a problem.

In our case, we use local debian packages to deploy our clients'
websites, for ease of management. That means we'd like to have each one
drop its own file in logrotate.d,
   
On each site-available/* config file (per site) within virtualhost 
directive:


ErrorLog /var/log/apache2/Yoursite/error.log
CustomLog /var/log/apache2/Yoursite/access.log

but that means they have to be in
separate stanzas, and therefore we end up reloading apache several
times.
   
There is no problem with reloading apache (is not equal to restart) that 
the purpose of reload.



We do have a site-base package, which can rotate all the logs matching
our setup, but that has limitations too, like being unable to specify
different periods for different sites and suchlike.

Yes, you can do it on your script or manually, see bellow.

It also doesn't
really deal with sites packaged by other entities, that don't
necessarily know about (or depend on) our site-base package.

   
For each virtualhost create /etc/logrotate.d/apache-yoursite, with 
this content (example).


/var/log/apache2/Yoursite/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if [ -f `. /etc/apache2/envvars ; echo 
${APACHE_PID_FILE:-/var$

/etc/init.d/apache2 reload  /dev/null
fi
endscript
}


Does anyone have any suggestions for improving this?

   

That works for my 70 named virtualhost in production enviroment.

Thanks,
   

Your're welcome.

Richard


   

--

-
   You don't know where your shadow will fall,
Somebody.-
-
 Ing. Olaf Reitmaier Veraciertaola...@gmail.com
-
 Personal Web Page -- http://olafrv.com -- i...@olafrv.com
-


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: http://lists.debian.org/4b909704.5050...@gmail.com



logrotate for multiple websites

2010-03-01 Thread Richard Hector
Hi all,

I understand that I can setup a logrotate entry with sharedscripts, so
it will only reload apache once for all the logs in that stanza.

That's fine, until you want to have multiple stanzas.

In our case, we use local debian packages to deploy our clients'
websites, for ease of management. That means we'd like to have each one
drop its own file in logrotate.d, but that means they have to be in
separate stanzas, and therefore we end up reloading apache several
times.

We do have a site-base package, which can rotate all the logs matching
our setup, but that has limitations too, like being unable to specify
different periods for different sites and suchlike. It also doesn't
really deal with sites packaged by other entities, that don't
necessarily know about (or depend on) our site-base package.

Does anyone have any suggestions for improving this?

Thanks,

Richard



-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/1267479799.3746.15.ca...@topaz.wgtn.cat-it.co.nz