Apache access_log rotation

Different versions of this question have been asked four times on the forum in the last year, but never answered.

I need to control Apache's access_log rotation so that it always writes the current file to

/var/log/apache2/access_log

But somewhere it is currently set to rotate the logs and to write to the most recently created file which appends a ten digit number to it -- in the directory /var/log/apache2/ I have now four files, each spaced about a week apart:

access_log
access_log.1299110400
access_log.1299715200
access_log.1300320000

and apache is currently writing to access_log.1300320000

past responders have said to "turn off log rotation" without explaining how

they have also said to check newsyslog.conf, and i have -- there is no entry there to rotate the apache logs.

there also does not seem to be anything in httpd.conf that is controlling this.

in essence, the system is currently rotating the logs in a strange way, and i can't figure out where the commands to rotate are coming from.

any help appreciated!

2 x 2.93 GHz 6-Core Intel Xeon Mac Pro, Mac OS X (10.6.4)

Posted on Mar 23, 2011 10:31 AM

Reply
5 replies

Apr 12, 2011 12:26 PM in response to James_Fowler

There are many ways to manage log file rotation. In most cases Apache pipes its logs through the /usr/sbin/rotatelogs application, so you might see a line like:

CustomLog '|/usr/sbin/rotatelogs "/var/log/apache2/access_log" 604800 -480' "%h %l %u %t \"%r\" %>s %b"


in your site's config file. Just replace the CustomLog line with the standard Apache log statement:

CustomLog /var/log/apache2/access_log common


Or turn off log rotation in Server Admin.

Jun 23, 2011 10:52 AM in response to Camelot

I have a stupid question regarding logging. I have many virtual sites setup up and they all use the same access and errors log files. When it comes to rotating the logs do I need to have it enabled on every virtual site configuration or would having it turned on in just one site to rotate the logs properly for all those sites?


Main reason I am asking is because I am seeing dozens of rotatelogs processes running and it makes me wonder if enabling the Archive Every x days checkbox on one site would be more effecient and still work properly?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apache access_log rotation

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.