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 to

LogLevel emerg

from

LogLevel debug

but i still see errors being posted about favicon.ico not being found and so on.

but also.. this error_log file is growing too large.

if i delete error_log file.. 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

also.. 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 see them.. either not be created at all. but also.. these "archived" ones.. do they ever get deleted or do i have to delete them myself ?

share|improve this question
add comment

2 Answers

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
add comment

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
add comment

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.