Clearing Apache Log Files

Apache log files can get large. Manually clearing apache log files become essential if there is no automatic clearing as part of the hosting environment.

I have a client hosted on their own vps server that was running out of disk space. I used the ssh command via putty:
du -sh *

showed a summary, in human-readable form, of total disk space used for each file and directory in the current directory, including subdirectories.

I identified that the log files were taking up significant space, and so needed to clear out the largest of the files.

I therefore used the following command to clear the log files that I had identified:

use this echo command to clear log will apache is running.
echo " "> /path/to/access_log

example:

echo " "> /var/log/httpd/log/access_log

another example:

echo " "> /usr/local/apache/logs/error_log

or on the clients site:

echo " "> /var/log/apache2/domain.co.nz-error.log

you can do this while apache is running.

Thanks to Common ssh commands, and theplanet How to Delete Apache Log Files Manually
Digg StumbleUpon del.icio.us technorati blinklist furl reddit sphinn

Tags: 


Post Comment

*
*


Visual CAPTCHA

*
Code is not case-sensitive
*

We welcome comments on this article, provided they have something to contribute. Please note that all links will be created using the nofollow attribute. This is a spam free zone. HTML is stripped from comments, but BBCode is allowed.