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

Yesterday I found that my Apache log file in my development machine was almost 50 GB in size.

Is there a way to limit the site of the Apache log file?

share|improve this question
up vote 5 down vote accepted

This is typically done using logrotate. Example logrotate configuration for Apache:

/var/log/httpd/*log {
    rotate 30
      /bin/kill -HUP `cat /var/run/ 2>/dev/null` 2> /dev/null || true
share|improve this answer
Mac OS 10.5 and up use newsyslog and the config file is located in /etc/newsyslog.conf. a man newsyslog and man newsyslog.conf should helped a lot!! – Onema Feb 18 '11 at 18:27

For Mac OS X 10.6 Snow Leopard (10.6.8),
  following Onema's comment (on an answer),
  I added this line to /etc/newsyslog.conf(5) (with reformatted whitespace):

# logfilename                   [owner:group]   mode    count   size    when    flags   [/pid_file]         [sig_num]
/var/log/apache2/*_log          70:70           644     5       1000    *       JG      /var/run/

It instructs to rotate all logs (3 for me) 5 times each when over 1000 "kilobytes", using bzip2(1)

share|improve this answer
Note that the [owner:group], [/pid-file], and [sig_num] fields are optional and hence can be omitted. – jeff303 Jan 28 '15 at 23:17

Building on Warner's suggestion, here's a logrotate config to delete your Apache logs if they grow larger than 5MB:

/var/log/httpd/*log {
share|improve this answer

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.