Apache Logs filled up by an attack?

Heres a script we use to clear the apache logs on linux when apache is being attacked and the server disk quota is being constantly filled and locking the server:

service apache2 stop

cd /var/log/apache2

rm *.gz

Truncate -s 0 /var/log/apache2/access.log

Truncate -s 0 /var/log/apache2/error.log

Truncate -s 0 /var/log/apache2/error.log.1

Truncate -s 0 /var/log/apache2/access.log.1

service apache2 start

Save the script in a file and make it executable (chmod +x filename) then place it in /etc/cron.hourly

Remember to remove it after the attack subsides!

Comments

Leave a Reply