Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I noticed my error_log file grows larger and larger.

I tried changing the LogLevel in httpd.conf from

LogLevel debug

to

LogLevel emerg

But I still see errors being posted about favicon.ico not being found and so on.

If I delete error_log, I would have to restart apache, which causes some downtime for current viewers.

  • Is there a way to tell apache NOT to write any error_log?
  • OR is there a way to ensure it does not grow beyond 1 mb ( when it is not turned off )?

I notice access_logs are being "archived", but I rather want them also not to be created at all.

Do these archived access_logs ever get deleted or do I have to delete them myself?

share|improve this question

2 Answers 2

You can use a utility such as cronolog to manage the web server log files. Using cronolog, log files can be automatically rotated without having to shut down and restart the web server.

excerpt

cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened. cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs.

share|improve this answer

You can use logrotate, which allows you to rotate the logs (based on the date, the size...) and to choose how many files you want to keep. For instance, here's my config file for apache:

/var/log/apache2/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                if /etc/init.d/apache2 status > /dev/null ; then \
                    /etc/init.d/apache2 reload > /dev/null; \
                fi;
        endscript
}
share|improve this answer

Your Answer

 
discard

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