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
echo " "> /var/log/httpd/log/access_log
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.
The above has worked for me and for the apache install my client has. But please be careful, noting the comments attached where people have found issues with their specific installs.