-
Notifications
You must be signed in to change notification settings - Fork 6
PM2 日志自动切割 #152
Copy link
Copy link
Closed
Labels
ServerThe invisible heroThe invisible heroSoftwareAbout installation ande usageAbout installation ande usage
Description
解决过程
在 PM2 官方文档中,提到可以安装 pm2-logrotate 这个库,来实现 PM2 日志的自动切割。
先执行命令 pm2 install pm2-logrotate 安装这个库。
然后执行下面的命令,对日志切割的选项进行配置:
# 单个日志文件体积超过 100M 后则自动切割
$ pm2 set pm2-logrotate:max_size 100M
# 保存最近 60 天的日志文件,更早的都删除
$ pm2 set pm2-logrotate:retain 60
# 对切割出来的旧日志文件进行 gzip 压缩
$ pm2 set pm2-logrotate:compress trueReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ServerThe invisible heroThe invisible heroSoftwareAbout installation ande usageAbout installation ande usage