How to create one uwsgi log file per day?

前端 未结 4 750
小鲜肉
小鲜肉 2021-02-14 13:11

I use uwsgi with the parameter --daemonize /logs/uwsgi.log

This file is however becoming large and I would like to split it into smaller pieces. One per day would be pre

4条回答
  •  Happy的楠姐
    2021-02-14 13:44

    uWSGI by itself can only "split by size", with the --log-maxsize option.

    Time-based approaches are using classic logrotate or apache rotatelogs (http://httpd.apache.org/docs/2.2/programs/rotatelogs.html) that you can combine with uWSGI logpipe plugin.

    Finally you can have an nginx like behaviour triggering a reload at midnight of the uWSGI instance (you can even use the embedded cron facility):

    [uwsgi]
    daemonize = /logs/uwsgi-@(exec://date +%%Y-%%m-%%d).log
    log-reopen = true
    

提交回复
热议问题