log files rotation

Lou Kamenov lou.kamenov at aeye-web.com
Wed Sep 25 15:51:24 BST 2002

On Wed, 25 Sep 2002 13:09:35 +0100
Pete French <pete at twisted.org.uk> wrote:

> > What did you use? Postgres with transactions compares quite favourably
> > to most alternatives these days.
from the research i`ve made 6 months ago, it looks like psql is more advanced in some points compared to mysql, however i mysql is lighter than psql and faster in some cases, but i think nowdays i`d choose psql.
It has everything you need, plus the desirable replication service for keeping your website/db redundant.

its the features that psql has.

however this is a huge OT :)

but for the apache logs files, its not so hard to write a script which would do the log rotation, i`d write it this way: 

logfiles=(web1 web2 httpd) 	# type? web1 - website1 
different_logs=(error common)	# if you have more than 1 log, etc.
logdir="/var/log/apache/"	# location?     
logsdb="/var/logs.db"		# where to store them?
run="/var/run"			# where is the pidfile?
apachectl="/sbin/kill"		# yeah sure :)
				# check if apache is up?		
if [ -r ${run}/httpd.pid ]; then
	pid="`cat ${run}/httpd`"
	if [ ${pid} ]; then #if its up.
		var1=0			# simple counter ;)
		while [ ${var1} -lt `echo $[${#logfiles[@]}+1]` ]; do
			for diffs in ${different_logs[@]}; do
			mv ${logdir}/${logfiles[${var}]}-${diffs}.log ${logsdb}/${logfiles[${var}]}-`date "+%d-%m-%Y"`-${diffs}.log
		let var1=var1+1
	# do a graceful restart (desirable)
		kill -USR1 ${pid}

its not c though it will do the job.
i`m sorry for any mistakes, if there are any ;)			


> I conerted the table types in mySQL to BDB, but there were too many
> irritations that would need ironing out.I havent llooked into moving
> everything to another DB engine entirely because so much other infrastructure
> has grown up around it that it would be a huge effort (= too much downtime).
> The transactiosn arent *that* important to be honest, it just left a bit of
> amess in the DB. I can cope with that on are occasions where the machines
> crash (i.e. never so far in 2 years of running) but having it every
> evening when the logs rotate was pesky. But thats now fixed thanks to
> some cunning advice from this list and a bit of coding with signals.
> -bat.
> ------ FreeBSD UK Users' Group  -  Mailing List ------
> http://listserver.uk.freebsd.org/mailman/listinfo/freebsd-users

More information about the Ukfreebsd mailing list