+3 votes
in Web & Google by (34.9k points)
The size of access_log, error_log and suphp_log keep increasing everyday and if I delete them, I need to restart Apache. I don't want to delete those files and restart apache every week. Is there any other way to empty those files?

1 Answer

+1 vote
by (157k points)
selected by
Best answer

If you have root access, log on to your server as root and do the followings:

[root@lazybox ~]# cd /usr/local/apache/logs/
[root@lazybox logs]# ls
access_log  error_log  httpd.pid  suphp_log
[root@lazybox logs]# >access_log
[root@lazybox logs]# >error_log
[root@lazybox logs]# >suphp_log
[root@lazybox logs]#

Basically, command >filename removes all contents of a file.