views:

37

answers:

4

Hello,

I have discovered that my access_log is occupying most of my HDD. It's over 200 GB in size. How can I reset it ?

I am using Apache 2.2.3 on a CentOS server with Plesk.

Thank you guys !

A: 

Rename the file to different filename and create new file with the name access_log

S.Mark
I have tried this. Apache keeps writing to the large file that has a new name.
Liam
A: 

Use the logrotate daemon in order to have a clean maintenance of your logs, specially, the apache related logs.

A brief info about logrotate: http://www.scriptinstallation.in/logrotate.html

Dez
A: 

Rename the file, create a new access_log, then restart Apache.

Liam
A: 

If you have access by SSH to the server, then you can:

1) Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this:

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

2) Clear the current file

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

3) Restart apache

Also as Dez has suggested consider using logrotate for production grade apache log archiving.

knx