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 = () => {
201
201
} ) ;
202
202
} ;
203
203
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
+
204
223
module . exports = function ( ) {
205
224
return setupJwt ( )
206
225
. then ( setupDefaultUser )
207
226
. then ( setupDefaultSettings )
208
- . then ( setupCertbotPlugins ) ;
227
+ . then ( setupCertbotPlugins )
228
+ . then ( setupLogrotation ) ;
209
229
} ;
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 {
2
2
create 0644 root root
3
3
weekly
4
4
rotate 4
11
11
endscript
12
12
}
13
13
14
- /data/logs/*_error.log /data/logs/*/*_error .log {
14
+ /data/logs/*_error.log /data/logs/*/error .log {
15
15
create 0644 root root
16
16
weekly
17
17
rotate 10
22
22
postrotate
23
23
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
24
24
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