-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog_rotate
More file actions
66 lines (36 loc) · 973 Bytes
/
log_rotate
File metadata and controls
66 lines (36 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
###For logrotate user must be within docker, log into your VPS and access docker, when you have finished use exit to leave the container.
### Logs will be deleted every 7 days.
sudo docker exec -it plinode /bin/bash
##Inside the container install nano:
apt-get install nano
##Install logrotate
apt-get install logrotate
##Move to correct directory and add a log rotate file in docker:
cd /etc/logrotate.d
##Create log file and add contents:
nano pm2logs
/root/.pm2/logs/*.log {
rotate 6
daily
compress
missingok
notifempty
maxage 7
}
##Create second log rotate file and add contents:
nano log.jsonl
/root/.plugin/log.jsonl {
rotate 6
daily
compress
missingok
notifempty
maxage 7
}
##Manually rotate logs
logrotate -vf /etc/logrotate.conf
##Test logrotate
logrotate -d /etc/logrotate.conf
##Confirm space before and after of log folders:
du -h /root/.pm2/logs
du -h /root/.plugin/log.jsonl