logrotate
設定
デフォルト値

 logrotate
 ・ログファイルの切替を行う、デフォルトで毎日午前4時2分
 ・コマンドの配置:/usr/sbin/
 ・設定ファイル「/etc/logrotate.conf」に従って処理
ログファイルの切替の周期
weekly
保存ログファイル数
rotate 4
ログファイル作成
create
設定の読込み
include /etc/logrotate.d
配下のファイルはそれぞれのログファイルに対する設定ファイルとして扱われる。
 ・設定ファイルの命令一覧

 logrotate設定の命令
命令 内容
compress 保存ログファイルの圧縮
compresscmd 圧縮コマンド gzip
uncompresscmd 解凍コマンド gunzip
copytruncate コピーによる切替
create ログファイル作成
daily 日単位の切替
delaycompress 圧縮の遅延
include 設定の読込み
monthly 月単位の切替
postrotate 切替直後の実行
prerotate 切替直前の実行
rotate 保存ログファイル数
size 切替サイズ k/M
sharedscript 複数ログファイル対応
weekly 週単位の切替

 /etc/logrotate.confのデフォルト値 # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # no packages own wtmp and btmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp minsize 1M rotate 1 } /var/log/btmp { missingok monthly create 0600 root utmp rotate 1 }