Date: Wed, 1 Aug 2001 15:26:39 -0500 From: "Robert Banniza" <robert@rootprompt.net> To: "Roelof Osinga" <roelof@eboa.com>, "Evan Oldford" <evan@whistle.com> Cc: "Kashyap Kumar" <modaya72@hotmail.com>, <freebsd-stable@FreeBSD.ORG> Subject: RE: Apache Log question! Message-ID: <GMEDKMKMEBENJMBLDHAIEEOKEEAA.robert@rootprompt.net> In-Reply-To: <3B686488.6FF5FCFE@eboa.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I use the following script within cron to get it done:
##################### BEGIN SCRIPT ########################
#!/bin/sh
# rotates webserver log files
DATE=`/bin/date +%m%d%Y_%H%M%S`
BASE_DIR='/var/log'
LOGS='httpd-access.log httpd-error.log'
for i in $LOGS; do
if [ -f $BASE_DIR/$i ]; then
/bin/cp $BASE_DIR/$i $BASE_DIR/$i.$DATE
> $BASE_DIR/$i
/usr/bin/gzip $BASE_DIR/$i.$DATE
fi
# search and delete older logs
/usr/bin/find $BASE_DIR -name $i.* -a -mtime +30 -exec rm {} \;
done
##################### END SCRIPT ########################
Robert
-----Original Message-----
From: owner-freebsd-stable@FreeBSD.ORG
[mailto:owner-freebsd-stable@FreeBSD.ORG]On Behalf Of Roelof Osinga
Sent: Wednesday, August 01, 2001 3:20 PM
To: Evan Oldford
Cc: Kashyap Kumar; freebsd-stable@FreeBSD.ORG
Subject: Re: Apache Log question!
Evan Oldford wrote:
>
> Kashyap Kumar wrote:
> >
> > Hi,
> >
> > Can anybody help me to rotate my apache logs in /var/log directory. How
can
> > I do that with syslog?
> >
> > help very much appriciated
> >
> > /mn
>
> http://www.freebsddiary.org/rotatelogs.php has a great example...
Take a look at .../ports/sysutils/cronolog, does a nice job although
it keeps a lot of processes around.
Roelof
--
_______________________________________________________________________
eBOAź est. 1982
http://eBOA.com/ tel. +31-58-2123014
mailto:info@eBOA.com?subject=Information_request fax. +31-58-2160293
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?GMEDKMKMEBENJMBLDHAIEEOKEEAA.robert>
