Nginx auto access log rotate

Jbn1233
1 min readJul 21, 2020

--

server {if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
}
access_log logs/access_log_$year$month$day main if=$loggable;...
...
}

There is a bug somewhere ,but it work

--

--

Jbn1233
Jbn1233

Written by Jbn1233

Very short and simple notes for CKA/SRE and may not works on your environment | jbn1233@gmail.com | Bangkok, Thailand |

No responses yet