logrotate設定 のバックアップ(No.4)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- logrotate設定 へ行く。
- 1 (2008-04-30 (水) 18:13:03)
- 2 (2008-04-30 (水) 18:15:21)
- 3 (2008-05-02 (金) 15:53:42)
- 4 (2014-04-20 (日) 12:31:04)
- 5 (2014-06-01 (日) 13:54:33)
logrotateの設定と使い方 †
ディレクトリ構成 †
OS標準のlogrotateは以下の設定ファイルを使用して稼動している。
- 本体の動作設定
/etc/logrotate.conf
- サービス毎の動作設定
/etc/logrotate.d/
設定手順 †
1. サービス用のログローテート設定ファイルを作成
2. 設定ファイルを/etc/logrotate.d/に配置
設定例1. (apache weekly 24rotate compress) †
/home/httpd/default/logs/access.log { weekly compress rotate 24 postrotate /etc/init.d/apachectl graceful endscript }
設定例2. (apache daily 40rotate compress) †
/home/httpd/default/logs/access.log { daily compress rotate 40 postrotate /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true endscript }
設定例3. (apache *log monthly 24rotate(2year) compress) †
/home/httpd/default/logs/*.log { monthly compress rotate 24 postrotate /etc/init.d/apachectl graceful endscript }