Forum Moderators: phranque

Message Too Old, No Replies

Can i disable Apache Log files?

Can i disable Apache Log files?

         

flashwebhost

6:18 pm on Jun 5, 2005 (gmt 0)

10+ Year Member



Hi,

I run Apache web server on FreeBSD.

I do not use the Log file for anything, so if its possible to stop generating the Log file?

Now i have to login to the server and delete the log files at times. I know i can get it auto delete, but not sure how to do this.

Also a small shell script like

apachectl stop
rm -f *.log
apachectl start

on cronjob will do, but i don't want to take risk, if apache won't start.

Regards,

Yujin

encyclo

6:30 pm on Jun 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] flashwebhost.

I don't think it is required to have Apache generate logs. You could simply make a back-up copy of httpd.conf and then comment out the lines relating to log generation. If Apache refuses to restart, then switch back to your backup httpd.conf.

If you can't find a way of stopping the generation of the logs, you can simply symlink access.log to /dev/null. Personally, I would at least keep error.log in case of problems.

py9jmas

7:26 pm on Jun 5, 2005 (gmt 0)

10+ Year Member



On FreeBSD, with a normal install of Apache2 from ports, I use something like
/var/log/httpd/*.log 644 6 * $M1D0 BG /var/run/httpd.pid 30

in /etc/newsyslog.conf.

Look in

man 5 newsyslog.conf
to see what the fields mean. Basically I rotate all the logs in /var/log/httpd at the start of every month. After the logs have been moved, Apache is sent signal 30, telling it to reopen its log file, ie create new empty logs. The last 6 log files are kept. Any older are deleted.

References:
[httpd.apache.org...]
[httpd.apache.org...]
[freebsd.org...]

flashwebhost

12:29 pm on Jun 6, 2005 (gmt 0)

10+ Year Member



Thanks all for the help.

I have added

/home/backup/*.log 644 4 * @T00 B /var/run/httpd.pid 30

to /etc/newsyslog.conf