nginx 日志按天分割存储
默认nginx不会分割日志,傻逼。当然你可以用 logrotate去切割,但是这里说一个比较省力的方法。也是会按天来生成日志。
map $time_iso8601 $logyear { default '0000'; "~^(\d{4})-(\d{2})-(\d{2})" $1; } map $time_iso8601 $logmonth { default '00'; "~^(\d{4})-(\d{2})-(\d{2})" $2; } map $time_iso8601 $logday { default '00'; "~^(\d{4})-(\d{2})-(\d{2})" $3; } access_log /var/log/nginx/access.$logyear-$logmonth-$logday.log apm_json;
0顶
0 踩
共 0 条评论