Delete error log files with cronjob

Hello,

the error log files in /var/log/apache2/domains get bigger and bigger over time. is there a possibility to delete the files regularly using a cronjob?

best regards

See logrotate

https://linux.die.net/man/8/logrotate

2 Likes

this looks very complicated. isn’t there an easier way? you can delete the logs with the command: cp /dev/null /var/log/apache2/domains/domain.log
can’t this command also be executed in the panel as a cronjob?

Logrotate is already installed in Hestia.

The config file for apache is here /etc/logrotate.d/apache2 and you decrese the time logs are kept

Test logrotate with:
logrotate -d /etc/logrotate.d/apache2

1 Like

Okay, thanks. I’ll check it out.