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

Tags: 

Post Commentpost a comment