Ubuntu 20.04.1 LTS: problem with logrotate and nginx

Tom H tomh0665 at gmail.com
Mon Mar 15 17:07:31 UTC 2021


On Sat, Mar 13, 2021 at 11:02 PM Lentes, Bernd
<bernd.lentes at helmholtz-muenchen.de> wrote:
>
> Afterwards:
>
> root at documents-oo:~# invoke-rc.d nginx rotate
>  * Re-opening nginx log files nginx                                                                                                                                                   [ OK ]
> root at documents-oo:~# invoke-rc.d nginx rotate
>  * Re-opening nginx log files nginx                                                                                                                                                   [ OK ]
> root at documents-oo:~# invoke-rc.d nginx rotate
>  * Re-opening nginx log files nginx                                                                                                                                                   [ OK ]
> root at documents-oo:~# invoke-rc.d nginx rotate
>  * Re-opening nginx log files nginx                                                                                                                                                   [ OK ]
> root at documents-oo:~# invoke-rc.d nginx rotate
>  * Re-opening nginx log files nginx                                                                                                                                                   [ OK ]
> root at documents-oo:~# invoke-rc.d nginx rotate
>  * Re-opening nginx log files nginx                                                                                                                                                   [ OK ]
> root at documents-oo:~# invoke-rc.d nginx status
> ● nginx.service - A high performance web server and a reverse proxy server
>      Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
>      Active: active (running) since Sat 2021-03-13 21:25:58 UTC; 29min ago
>        Docs: man:nginx(8)
>     Process: 852 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
>     Process: 1088 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
>    Main PID: 1089 (nginx)
>       Tasks: 13 (limit: 19100)
>      Memory: 33.1M
>      CGroup: /system.slice/nginx.service
>              ├─1089 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
>              ├─1090 nginx: worker process
>              ├─1091 nginx: worker process
>              ├─1092 nginx: worker process
>              ├─1093 nginx: worker process
>              ├─1094 nginx: worker process
>              ├─1095 nginx: worker process
>              ├─1096 nginx: worker process
>              ├─1097 nginx: worker process
>              ├─1098 nginx: worker process
>              ├─1099 nginx: worker process
>              ├─1100 nginx: worker process
>              └─1101 nginx: worker process
>
> Mär 13 21:25:55 documents-oo systemd[1]: Starting A high performance web server and a reverse proxy server...
> Mär 13 21:25:57 documents-oo nginx[852]: nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/ds.conf:35
> Mär 13 21:25:58 documents-oo nginx[1088]: nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/ds.conf:35
> Mär 13 21:25:58 documents-oo systemd[1]: Started A high performance web server and a reverse proxy server.
>
> Nothing exciting happened.

What are you expecting? "access_log" to be rotated to "access_log.X"
and "access_log" to start from scratch?

This isn't how it works. You have to move "access_log" to
"access_log.X" and run "kill -USR1 $(cat /run/nginx.pid)" or your
"invoke-rc.d" command. I wouldn't rely on the latter if I were you.
The Ubuntu maintainer could remove "/etc/init.d/nginx", inherited from
Debian, or the Debian maintainer could move it to "/usr/share/..." or
delete it, and the "rotate" will disappear from the default (I'm
surprised that it works currently given that
"/usr/lib/system/systemd/nginx.service" exists!).




More information about the ubuntu-users mailing list