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
[uwsgi]
wsgi-file = bean/wsgi.py
# 重启时间
# harakiri = 10
# 主进程
master = true
# 4个进程/workers
processes = 4
# 两个核心
threads = 2
# 开启线程
enable-threads = true
# 单个进程最大请求数
max-requests = 5000
# 解包缓冲区大小
buffer-size = 65536
reload-mercy = 8
stats = 127.0.0.1:5000
pidfile = /var/run/itpserver.pid
vacuum = true
disable-logging = true
logto = /opt/logs/uwsgi.log
touch-logreopen = /opt/logs/.touchforlogrotat
And
#!/bin/bash
if [ ${ITM_CONFIG}=="test" ]
then
LOGDIR="/home/logs"
else
LOGDIR="/opt/logs"
fi
DATE=`date -d "yesterday" +"%Y-%m-%d"`
BACKUPCOUNT="7"
DELDATE=`date -d "${BACKUPCOUNT} day ago" +"%Y-%m-%d"`
mv ${LOGDIR}/uwsgi.log ${LOGDIR}/uwsgi.${DATE}.log
rm -f ${LOGDIR}/uwsgi.${DELDATE}.log
touch ${LOGDIR}/.touchforlogrotat
And add crontab with this sh:
@daily sh /home/share/logbackups.sh # uwsgilogrotat
A friendlier way