CentOS 6.3 でのお話。 Apacheをyumでインストールすると、Apacheログのローテート設定ファイルが作られる。 # less /etc/logrotate.d/httpd /var/log/httpd/*log { missingok notifempty sharedscripts delaycompress postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript } logrotateはcronで実行されるようになっている。 # ls /etc/cron.daily logrotate このlogrotateの中身を確認すると #!/bin/sh /usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1 EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" fi exit 0 となっていて、以下の /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 infor...
かつて、なんでも屋さんだった自称SEさんが、メモ代わりに書いてます。