Rotate Log Daily For uWSGI With Logrotate (Ubuntu 16.04)

Dec 12, 2017

Refer to my uwsgi setup.

cd /etc/logrotate.dsudo nano uwsgi

The following will create a daily log which keep history for 14 days.

/var/log/uwsgi/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        create 0640 www-data www-data
        sharedscripts
        postrotate
                systemctl restart emperor.uwsgi.service >/dev/null 2>&1
                # service uwsgi restart >/dev/null 2>&1
        endscript
}

Debug logrotate for errors.

logrotate -d /etc/logrotate.d/uwsgi

Force run logrotate.

sudo logrotate -vf /etc/logrotate.d/uwsgi

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.