vi /etc/logrotate.com
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressext .xz
compressoptions -9
以上是變更壓縮法
接下來要記錄的是 pm2 的壓縮設定
由於 pm2 是安裝在另一個 user
所以格式如下
/home/user/.pm2/logs/*.log {
daily
missingok
rotate 15
compress
delaycompress
notifempty
create 640 user user
sharedscripts
postrotate
pm2 reloadLogs
endscript
su root user
}
error: skipping "/home/user/.pm2/logs/error-0.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
修正方法
在 logrotate 的設定檔最下方,加上 su root user 即可
這個設定是參考這裡
留言
張貼留言