Wow, did I forget to do something. I was just cleaning up my mac mini server. Well that’s what you do when you’ve been playing around with lots of configurations and compiled different versions of software to see if it will work. When I found out that I completely forgot about the logfiles for my Apache installation. Some of the logfiles of the more popular sites where already a whopping 100+ Mb.

Normally, for the Apple installed Apache, the logfiles would reside in /var/log/httpd, but I didn’t think and just followed the standard layout that was provided by the installation which directed the logfiles into /Library/Apache2/logs as you can see in the installation document. This means that the default weekly script (located in /etc/periodic/weekly) that takes care of the regular maintenance of your Mac, and rotates your Apache logfiles, didn’t take care of my new Apache2 logfiles.

So I’ve created a new script that rotates my Apache2 logfiles without having to change everything. You can download my apache.local script and copy it into your /etc/periodic/weekly/ directory, give it proper flags/rights to make it executable using:

sudo chown root:wheel /etc/periodic/weekly/apache.local
sudo chmod +x /etc/periodic/weekly/apache.local

Then test it out by running:

sudo /etc/periodic/weekly/apache.local

Now your logfiles won’t fill up your harddrive unnecessarily and by keeping smaller logfiles your Apache will run a bit better as well. Please note that your logfiles should have a filename that ends with log or it won’t work.

Note: please vote where the logfiles should reside (before I start updating the installation documents), in /var/log or /Library/Apache2/logs in the related forum topic. You need to register and wait for account activation if you haven’t already. Sorry, it’s needed to prevent those pesky spammers.