Deployed my laravel application few months ago, and recently found out that my application was unable to write to log because my disk was full. When i checked i found out that the laravel.log file was almost huge. I want to know how to rotate the laravel logs with logrotate.
Go to /etc/logrotate.d and create a new config file.
cd /etc/logrotate.d
sudo touch laravel_rotate
Add the log file location and some settings.
log/file/dir/laravel_log.log {
monthly
missingok
rotate 12
compress
notifempty
create 755 www-data www-data
}
Settings explained:
To test this new config, run sudo logrotate --force /etc/logrotate.d/laravel_rotate