File tree Expand file tree Collapse file tree 2 files changed +24
-17
lines changed
docker/rootfs/etc/logrotate.d Expand file tree Collapse file tree 2 files changed +24
-17
lines changed Original file line number Diff line number Diff line change @@ -201,9 +201,29 @@ const setupCertbotPlugins = () => {
201201 } ) ;
202202} ;
203203
204+
205+ /**
206+ * Starts a timer to call run the logrotation binary every two days
207+ * @returns {Promise }
208+ */
209+ const setupLogrotation = ( ) => {
210+ const intervalTimeout = 1000 * 60 * 60 * 24 * 2 ; // 2 days
211+
212+ const runLogrotate = async ( ) => {
213+ await utils . exec ( 'logrotate -f /etc/logrotate.d/nginx-proxy-manager' ) ;
214+ logger . info ( 'Logrotate completed.' ) ;
215+ } ;
216+
217+ logger . info ( 'Logrotate Timer initialized' ) ;
218+ setInterval ( runLogrotate , intervalTimeout ) ;
219+ // And do this now as well
220+ return runLogrotate ( ) ;
221+ } ;
222+
204223module . exports = function ( ) {
205224 return setupJwt ( )
206225 . then ( setupDefaultUser )
207226 . then ( setupDefaultSettings )
208- . then ( setupCertbotPlugins ) ;
227+ . then ( setupCertbotPlugins )
228+ . then ( setupLogrotation ) ;
209229} ;
Original file line number Diff line number Diff line change 1- /data/logs/*_access.log /data/logs/*/*_access .log {
1+ /data/logs/*_access.log /data/logs/*/access .log {
22 create 0644 root root
33 weekly
44 rotate 4
1111 endscript
1212}
1313
14- /data/logs/*_error.log /data/logs/*/*_error .log {
14+ /data/logs/*_error.log /data/logs/*/error .log {
1515 create 0644 root root
1616 weekly
1717 rotate 10
2222 postrotate
2323 /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
2424 endscript
25- }
26-
27- /data/logs/*.log /data/logs/*[!_error].log /data/logs/*[!_access].log {
28- create 0644 root root
29- weekly
30- rotate 5
31- missingok
32- notifempty
33- compress
34- sharedscripts
35- postrotate
36- /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
37- endscript
38- }
25+ }
You can’t perform that action at this time.
0 commit comments