I have found that my access_log is taking up the majority of my Hard disk drive. It's over 200 GB in dimensions. How do i totally reset it ?

I'm using Apache 2.2.3 on the CentOS server with Plesk.

Thank everyone !

Relabel the file to various filename and make new file using the title access_log and restart apache (otherwise apache keeps the lock around the file and do not "see" the file change)

Make use of the logrotate daemon to be able to possess a clean upkeep of your logs, specifically, the apache related logs.

A short information on logrotate: http://www.scriptinstallation.in/logrotate.html

Relabel the file, produce a new access_log, then restart Apache.

For those who have access by SSH towards the server, you'll be able to:

1) Gzip that old file (text files compression ratios work great). When we assume the file is known as /var/log/apache/access.log then do that:

gzip -c /var/log/apache/access.log > /var/log/apache/access.log.gz

2) Obvious the present file

echo > /var/log/apache/access.log

3) Restart apache

Also as Dez has recommended think about using logrotate for production grade apache log archiving.

knx'answer is nice, but I recommend to relabel the log, and make up a brand new one, to ensure that you are able to restart apache without awaiting the access log to become compressed, which could require sometime whether it's large.

needs use of ssh

First, relabel the present log file:

mv /var/log/apache/access.log /var/log/apache/access.log.1

Second, produce a new log file and provide exactly the same permissions, owner/group and selinux context because the original one:

touch /var/log/apache/access.log
chown --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
chmod --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
restorecon --reference=/var/log/apache/access.log.1 /var/log/apache/access.log

(most likely have to be root to achieve that)

Next, restart apache

Then Gzip that old file (text files compression ratios work great). When we assume the file is known as /var/log/apache/access.log then do that:

gzip -c /var/log/apache/access.log.1 > /var/log/apache/access.log.1.gz

these 4 points are what logrotate do instantly.