Shopware 6 - Log Rotation / Logrotate

Shopware 6 logs all PHP exceptions that occur in the var/log directory using the following format: prod-YYYY-MM-DD.log. The Monolog library is used for this purpose.

Unfortunately, Shopware does not offer a log rotation option by default, so you’ll need to use logrotate (Linux) instead.



Linux Logrotate

Navigate to the /etc/logrotate.d/ directory and create a new file using the touch shopware command.


touch /etc/logrotate.d/shopware


/var/www/vhosts/shopware.creoline-demo.com/log/*.log {
    daily
    size 50M
    rotate 14
    notifempty
    missingok
    nocompress
}


The daily and rotate 14 directives instruct the logrotate daemon to rotate the Shopware log files daily for 14 days.