프로젝트
GitHub에서 보기
keymetrics/pm2-logrotate
소개
PM2가 관리하는 모든 애플리케이션의 로그를 자동으로 순환합니다
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +1
- in 1 month
- +1
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalDescription
PM2 module to automatically rotate logs of processes managed by PM2.
Install
pm2 install pm2-logrotate
NOTE: the command is pm2 install NOT npm install
Configure
max_size(Defaults to10M): When a file size becomes higher than this value it will rotate it (its possible that the worker check the file after it actually pass the limit) . You can specify the unit at then end:10G,10M,10Kretain(Defaults to30file logs): This number is the number of rotated logs that are keep at any one time, it means that if you have retain = 7 you will have at most 7 rotated logs and your current one.compress(Defaults tofalse): Enable compression via gzip for all rotated logsdateFormat(Defaults toYYYY-MM-DD_HH-mm-ss) : Format of the data used the name the file of logrotateModule(Defaults totrue) : Rotate the log of pm2's module like other appsworkerInterval(Defaults to30in secs) : You can control at which interval the worker is checking the log's size (minimum is1)rotateInterval(Defaults to0 0 * * *everyday at midnight): This cron is used to a force rotate when executed. We are using node-schedule to schedule cron, so all valid cron for node-schedule is valid cron for this option. Cron style :TZ(Defaults to system time): This is the standard tz database timezone used to offset the log file saved. For instance, a value ofEtc/GMT+1, with an hourly log, will save a file at hour14GMT with hour13(GMT+1) in the log name.
* * * * * *
┬ ┬ ┬ ┬ ┬ ┬
│ │ │ │ │ |
│ │ │ │ │ └ day of week (0 - 7) (0 or 7 is Sun)
│ │ │ │ └───── month (1 - 12)
│ │ │ └────────── day of month (1 - 31)
│ │ └─────────────── hour (0 - 23)
│ └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, OPTIONAL)
How to view current configuration of the above values ?
After having installed the module, you have to type :
pm2 conf
How to set these values ?
After having installed the module you have to type :
pm2 set pm2-logrotate:<param> <value>
e.g:
pm2 set pm2-logrotate:max_size 1K(1KB)pm2 set pm2-logrotate:compress true(compress logs when rotated)pm2 set pm2-logrotate:rotateInterval '*/1 * * * *'(force rotate every minute)
관련 프로젝트 살펴보기
불러오는 중…