nginx日志不切割的话会很大,以前是通过crontab定时切割并reload来切割日志,稍微有点麻烦,最近找到一个使用内置函数的办法(根据正则配置可精确到秒),如下,写在server里面:
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
}
access_log /home/logs/189-${year}-${month}-${day}-access.log access;
评论区