ログローテーション logrotate
logrotateを使ったログのローテーション
コンフィグは下記のファイルに書かれている。
# vi /etc/logrotate.conf
----
weekly
rotate 4
create
include /etc/logrotate.d
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
デフォルト、1週間おきに過去ログ4つ作る
namedのファイルを元にsquidのログをローテーションさせてみます。
# cd /etc/logrotate.d
# cp named squid
# vi squid
----
/usr/local/squid/var/logs/access.log {
missingok
postrotate
/usr/bin/kill -HUP `cat /usr/local/squid/var/logs/squid.pid 2> /dev/null` 2> /dev/null || true
endscript
}
/usr/local/squid/var/logs/cache.log {
missingok
postrotate
/usr/bin/kill -HUP `cat /usr/local/squid/var/logs/squid.pid 2> /dev/null` 2> /dev/null || true
endscript
}
/usr/local/squid/var/logs/store.log {
missingok
postrotate
/usr/bin/kill -HUP `cat /usr/local/squid/var/logs/squid.pid 2> /dev/null` 2> /dev/null || true
endscript
}
--参考ページ
http://park15.wakwak.com/~unixlife/linux/sys-logrotate.html
http://www.itmedia.co.jp/help/tips/linux/l0291.html
http://luac.net/~ssk/pwiki/index.php?logrotate#content_1_12
「Linux」カテゴリの記事
- 外付けHDD データリカバリー(2012.04.13)
- MacOS風インターフェース PearLinux(Comice)(2012.03.20)
- レスキュー用 ブートLinux(2011.10.12)
- USBメモリ起動 BackTrack 5(2011.08.12)
- USBメモリ起動 Vine Linux 6.0(インストールのみ)(2011.08.11)



Comments