The best method to do that would be via a cron job which you can set up in your cPanel.

Example command line:

1) If you want to keep a copy of the logs:

zip -9 /magento-install-dir/var/log/system-exception.log-`date +%d-%m-%Y-%H-%M`.zip /magento-install-dir/var/log/system.log /magento-install-dir/var/log/exception.log

Replace Magento-install-dir with the actual path to your Magento installation directory.

I can recommend running the above on the 1st and 15th of each month:

Compressing the logs can save you more than 90% of the file size!

 

2) If you do not need a copy of the logs, you can create a cron job with the following command:

> /magento-install-dir/var/log/system.log && > /magento-install-dir/var/log/exception.log

Replace Magento-install-dir with the actual path to your Magento installation directory.

It's done !!

Was this answer helpful? 0 Users Found This Useful (0 Votes)