jlesage / docker-nginx-proxy-manager

Docker container for Nginx Proxy Manager
MIT License
756 stars 167 forks source link

Log not getting rotated #219

Closed Miwer closed 2 years ago

Miwer commented 2 years ago

(running latest version)

There seem to be some discrepancy in the /etc/nginx/conf.d/default.conf file. the 8080 host is logging to /data/logs/fallback_access.log while the 4443 host is logging to /data/logs/fallback-access.log

This causes two fallback access logs to be created, and one of them is not rotated due to the rule setup in logrotate.d

(also I thought only "log" directory was supposed to exist, not "logs", so maybe there's an additional fix there?)

Also error log on the 4443 host is set to /dev/null crit - I think it should point to fallback_error.log like the 8080 host, just as the access log is probably meant to point to the same log file on both the 8080 and 4443 host.

-rw-r--r-- 1 docker users 1247841 Nov 21 12:29 fallback-access.log
-rw-r--r-- 1 docker users       0 Aug 25 10:16 fallback_access.log
-rw-r--r-- 1 docker users       0 Sep 27 00:13 fallback_error.log
-rw-r--r-- 1 docker users     246 Sep 26 23:57 fallback_error.log.1.gz
-rw-r--r-- 1 docker users     120 Sep 15 17:29 fallback_error.log.2.gz
-rw-r--r-- 1 docker users     147 Sep 12 22:27 fallback_error.log.3.gz
-rw-r--r-- 1 docker users     114 Aug 29 23:46 fallback_error.log.4.gz
-rw-r--r-- 1 docker users     119 Aug 29 23:43 fallback_error.log.5.gz
Miwer commented 2 years ago

also error.log is not rotated. I can see in the logrotate rule it utilizes the recursive log symbolic link in the log directory (rule is "/data/logs/*/error.log"), but the symbolic link is wrong - it points to itself creating an infinite loop, when trying to do anything with it.

I believe the symbolic link should instead point to "." (the current directory)

bash-5.0# ls -l /data/log/log* 
lrwxrwxrwx    1 root     users            3 Nov 21 12:20 /data/log/log -> log

bash-5.0# cd /data/log/log 
bash: cd: /data/log/log: Symbolic link loop
tonyhardcode commented 2 years ago

My /appdata/NginxProxyManager/log and logs folder contain logs from months ago. Are these rotated/purged after a certain amount of time?

jlesage commented 2 years ago

There seem to be some discrepancy in the /etc/nginx/conf.d/default.conf file. the 8080 host is logging to /data/logs/fallback_access.log while the 4443 host is logging to /data/logs/fallback-access.log

This causes two fallback access logs to be created, and one of them is not rotated due to the rule setup in logrotate.d

Good catch, I will fix that.

Also error log on the 4443 host is set to /dev/null crit - I think it should point to fallback_error.log like the 8080 host, just as the access log is probably meant to point to the same log file on both the 8080 and 4443 host.

I think this is correct. Because there is no valid SSL certificate to present when reaching a non-configured host and because we forcefully terminate the connection (return 444), errors are ignored since they are not relevant.

also error.log is not rotated. I can see in the logrotate rule it utilizes the recursive log symbolic link in the log directory (rule is "/data/logs/*/error.log"), but the symbolic link is wrong - it points to itself creating an infinite loop, when trying to do anything with it.

I will fix the bad symlink. However, this is not the cause of error.log not being rotated. The problem seems to be with the logrotate file path definition: it should be /data/logs/error.log instead of /data/logs/*/error.log.

jlesage commented 2 years ago

This should be fixed with the latest Docker image.