ログローテーション logrotate インストール
logrotateインストール
[root@freebsd ~]# cd /usr/ports/sysutils/logrotate
[root@freebsd logrotate]# make BATCH=yes install clean
[root@freebsd logrotate]# cd
logrotate.conf編集
[root@freebsd ~]# cp /usr/local/etc/logrotate.conf.sample /usr/local/etc/logrotate.conf
[root@freebsd ~]# vi /usr/local/etc/logrotate.conf
errors root
↓
#errors root ←コメントアウト
compress
↓
#compress ←コメントアウト
↓下記をコメントアウト
#/var/log/lastlog {
# monthly
# rotate 1
#}
設定ファイル格納ディレクトリ作成
[root@freebsd ~]# mkdir /usr/local/etc/logrotate.d
cronに登録
[root@freebsd ~]# vi /etc/crontab
↓最終行に下記を記入
0 0 * * * root /usr/local/sbin/logrotate /usr/local/etc/logrotate.conf > /dev/null 2>&1
ヒント
/usr/local/sbin/logrotate -d /usr/local/etc/logrotate.conf ←ステータス更新。
/usr/local/sbin/logrotate -f /usr/local/etc/logrotate.conf ←ローテーション強制実行。
|