8
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

logrotate の設定を確認する

Posted at

シンタックスエラーは -d オプションでチェックできる。

$ logrotate -d /etc/logrotate.d/hoge

この場合、rotate は実行されない。

postscript などの動作も確認したい場合、logrotate /etc/logrotate.d/hoge とすれば cron を待たずに実行できるけど、タイミングによっては必ずしも rotate されない。
そういった場合は --force で強制的に rotate できる。

さらに daily/weekly/yearly などの動作も確認したい場合は、logrotate.status を変更する。
デフォルトは /var/lib/logrotate.status で、--status オプションで変更できる。
logrotate は status ファイルに、いつ rotate したかを記録し、次回実行時にそれを元に rotate するか判断する。
従って logrotate.status を変更すれば、--force を使わずとも rotate の確認が可能になる。

8
10
0

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
8
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?