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

my is newbie's question:

how can i set error.log file and all various logs to keep only few days of log? my files are huge now! i cant keep 20GB of just logs! i saw and increase of diskspace like form 30% to 110% in 5 days... maybe i have a running process that creates a background error? in any case is it pobbisle to limit of the size of those files??

how do you access those logs? i mean do you just use terminal to read them? via webmin?

share|improve this question

You should set up logrotated to automatically rotate the logs round.

/var/log/apache2/*log {
        rotate 7
        create 777 apache apache

should get you going as a basic config (Put it in /etc/logrotate.d/httpd), that rotates the files round daily and keeps them for 7 days. There are lots of options available for logrotated (Like GZIP, rotate on size etc.)

And for reading them, normally you would use something like webalizer or AWStats to create a 'pretty' version of your logs.

share|improve this answer
Kind of - That should be 'create 644'. 'missingok' and 'notifempty' would be good too - also, you should tell apache to close and reopen the log file - '/sbin/service httpd reload > /dev/null 2>/dev/null || true' (in a postrotate block) – symcbean May 16 '11 at 12:52

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.