Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

/var/log/apache2/*log {
        daily
        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

 
discard

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.