Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Apache combined log files are getting too large each day in a single file, it is hitting over hundreds megabytes,

Which is a quick way or how can i configure to store files per day basis?

Will this work ?

CustomLog "|/usr/sbin/rotatelogs -l /var/log/httpd/access.log.%Y-%m-%d 2419200"

operating on LINUX

share|improve this question
Which operating system are you using ? – Iain Feb 8 '12 at 9:27
up vote 2 down vote accepted

use rotatelogs

CustomLog "|/usr/sbin/rotatelogs PATH_TO_LOG_DIR/access_log.%Y%m%d 86400 -360" common

share|improve this answer
this should be put into your vhost file in sites-enabled of your apache config dir – mlaug Feb 8 '12 at 9:45
That's rotatelogs, not logrotate. logrotate is usually run from a cron job and rotates existing logs. The config directory is /etc/logrotate.d/. – Ladadadada Feb 8 '12 at 10:00

As you are using linux, you can use the logrotate. Something like this which is lifted from an Ubuntu system I have handy but note you'll probably need to modify it for other distributions.

/var/log/apache2/*.log {
        rotate 7
        create 640 root adm
                if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/}`" ]; then
                        /etc/init.d/apache2 reload > /dev/null
share|improve this answer

If you are using Linux then logrotate. Or you can log to a remote server directly for example with syslog-ng.

share|improve this answer
You can also use rsyslog instead of syslog-ng. – Ladadadada Feb 8 '12 at 10:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.