Deleted Apache access logs still taking up space

more than likely you have deleted the logs but apache has locked them up.

You should use lsof and look for (deleted). IBM guide here. The way to fix is to restart the apache process to release the file.


Try to copy /dev/null to your logfile. This should truncate your file without closing the file handle apache is holding...

cp /dev/null other_vhosts_access.log.1

I had the same problem and I solved as follows.

PROBLEM:

I deleted manually access_log and error_log in directory /var/www/vhosts/mywebsite/logs/mywebsite1/ to free up space, but even if the files are disappeared, space is not freed.

SOLUTION:

I used lsof sorted by size to search big file (command found here):

lsof -s | awk '$5 == "REG"' | sort -n -r -k 7,7 | head -n 100

I found the two big files access_log and error_log in another path (note the difference with previous path):

/var/www/vhosts/system/mywebsite1/logs/

I reset these two files with command:

:>/var/www/vhosts/system/mywebsite1/logs/access_log

:>/var/www/vhosts/system/mywebsite1/logs/error_log

The files have been emptied and the space is freed.

Hope it can be helpful.