logrotateがうまくいかない?

新しいサーバーを納入して一週間が経過、昨日の日曜日の深夜CPUのアラートが上がったと申告が。いろいろ調べてみたんですが、どうにも原因が分からない。そんな折/var/log/messagesにこんなエラーが・・・

Feb 9 04:02:12 hogehoge logrotate: ALERT exited abnormally with [1]
Feb 10 04:02:09 hogehoge logrotate: ALERT exited abnormally with [1]
Feb 11 04:02:10 hogehoge logrotate: ALERT exited abnormally with [1]
Feb 12 04:02:10 hogehoge logrotate: ALERT exited abnormally with [1]

げげげ!!と思ってログを確認してみると、ローテーションが正常に行われていない!!
あわててログのローテーションが正常に行われているかをチェックします。

# /usr/sbin/logrotate -vd /etc/logrotate.conf
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file acpid
reading config info for /var/log/acpid
reading config file cups
reading config info for /var/log/cups/*_log
reading config file httpd
reading config info for /var/log/httpd/*log /var/log/httpd/hogehoge/*log
reading config file httpd.default
error: httpd.default:1 duplicate log entry for /var/log/httpd/access_log
*コマンドは-vdで詳細を出力+デバッグモードで表示になります

やっぱりエラーが出ていました。ちゃんと事前に確認しておかないとだめですね・・・

原因をいろいろと調べてみました。今回ログをローテーションするにあたってhttpdのログローテーション(/etc/logrotate.d/httpd)を変更したんですがそのときにデフォルトファイルをhttpd.defaultで保存して同じディレクトリに置いておいたんです。どうやらそれが原因の様子。
ファイルを.httpd.defautにして隠しファイルにしてみたんですが結果は変わらず。ためしに別のディレクトリに移してみたところようやく正常に動作したようです。

# mv httpd.default ../
# /usr/sbin/logrotate -vd /etc/logrotate.conf
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file acpid
reading config info for /var/log/acpid
reading config file cups
*****長いので割愛*****

ちゃんと動作確認を行ってから出ないと危険ですね!