LoginSignup
7
9

More than 5 years have passed since last update.

logrotate設定ファイルを書きだすためのpm2 logrotateコマンドの説明

Last updated at Posted at 2015-09-07

参考サイト

pm2-logrotate
Displaying logs in real-time

PM2のプラグインを使って設定ファイルを書き出してみる

pm2 install pm2-logrotate

root権限じゃないと実行できないので sudo で実行

sudo pm2 logrotate -u user

/etc/logrotate.d/pm2-user

といファイルが書き出される

最初フォルダが、root 以下になっていたのでユーザーのhomeフォルダに変更しておく
※rootで実行しているならそのままでいいと思う

/home/user/.pm2/pm2.log /home/user/.pm2/logs/*.log {
  rotate 12
  daily
  notifempty
  compress
  delaycompress
  create 0640 user user
}

多分これで出来てるはず…

7
9
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
9