Delete apache log files older than x days on Ubuntu

Assuming that the apache logs are under the /var/log/apache2 folder and you only want to delete .gz files older than 2 days:

find /var/log/apache2/*.gz -mtime +2 -exec rm {} \;

 

Leave a Comment

Your email address will not be published. Required fields are marked *