- 追加された行はこの色です。
- 削除された行はこの色です。
**logrotateの設定と使い方 [#mfe48015]
#Contents
**ディレクトリ構成 [#fe1811e3]
OS標準のlogrotateは以下の設定ファイルを使用して稼動している。~
-本体の動作設定
/etc/logrotate.conf
-サービス毎の動作設定
/etc/logrotate.d/
**設定手順 [#w30044fc]
1. サービス用のログローテート設定ファイルを作成~
2. 設定ファイルを/etc/logrotate.d/に配置~
3. 設定ファイルに実行属性を付ける
**設定例1. (apache weekly 24rotate compress) [#g634460b]
/home/httpd/default/logs/access.log {
weekly
compress
rotate 24
postrotate
/etc/init.d/apachectl graceful
endscript
}
**設定例2. (apache daily 40rotate compress) [#g94d1664]
/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) [#h46b1c20]
/home/httpd/default/logs/*.log {
monthly
compress
rotate 24
postrotate
/etc/init.d/apachectl graceful
endscript
}