Rotating Apache Logfiles

Apache PHP and FreeBSD

vlogger is used to rotate and organize apache log files. vlogger is a perl program and can be found at


Download the latest version of vlogger and save it to /usr/local/src

# cd /usr/local/src
# fetch
# tar -xvpzf vlogger-1.3.tar.gz
# cd vlogger-1.3
# cp vlogger /usr/local/sbin
# cp vlogger.1 /usr/local/man/man1

Install perl 5.8 port if it’s not already installed

# cd /usr/ports/lang/perl5.8
# make -DWITH_THREADS=yes install
# make clean
# usr.perl por

Re-install any previous perl packages. To find out what perl packages are already installed on the system use: ls -ald /var/db/pkg/p5-*

Install the perl TimeDate port

# cd /usr/ports/devel/p5-TimeDate
# make
# make install
# make clea

Installing the logger into Apache

Edit the apache config file (/usr/local/etc/apache/httpd.conf) and change the ErrorLog variables to the following…

ErrorLog “|/usr/local/sbin/vlogger -e -s error.log -t error_%Y%m.log /var/log/apache”
CustomLog “|/usr/local/sbin/vlogger -s access.log -t access_%Y%m.log /var/log/apache” combined

Edit the LogFormat variable in the apache conf file and add %v at the begining of the string.

Restart apache

# /usr/local/etc/rc.d/ restart

Leave a Comment

Your email address will not be published. Required fields are marked *