named cannot record a log via rsyslog after running logrotate
環境
- Red Hat Enterprise Linux 6
- bind
- implement bind-chroot, and chroot is executed.
- configure writing a named log into a file /var/log/named/named.log via rsyslog.
- logrotate
- make the above named.log targeted for logrotation.
問題
- I configure writing named message into the file /var/log/named/named.log via rsyslog.
- named.log output by rsyslog is targeted for roglation in /etc/logrotate/syslog.
- After conducting logrotation by crond, messages cannot be written into named.log.
解決策
This is an unique symptom in the situation where named is chrooted, so it is difficult to execute named in the chroot environment and output to rsyslog, and logrotate at the same time.
It is recommended to stop chroot environment, or named, not syslog, output its log.
原因
It is caused by reload for rsyslog service run by logrotate.
-- /etc/logrotate.d/syslog --
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/named/named.log
{
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
reload in rsyslog service creates /dev/log again which is a message queue of rsyslog when re-loading the setting.
After booting a service, the opened /dev/log is continuously used unless it is chrooted, but when /dev/log is created again by reload in rsyslog, named loses /dev/log.
Since /dev/log does not exist under chroot environment, it cannot be opened again, and log cannot be sent via syslog.
このソリューションは、Red Hat のエンジニアがお客様のサポート中に作成したナレッジコンテンツの大型ライブラリーを提供する Fast-Track Publication Program の一環です。お客様が必要とする知識・情報を即時に提供するために、これらの記事は、未処理・未編集の状態で提示される場合がありますので、予めご了承ください。
コメント