next up previous contents
Next: Dnsmasq server Up: DNS server Previous: 安全機制   Contents

問題解決

  1. 問題一:使用 rsyslog 每週會重建 /var/log/messages,但當重新產生新的 /var/log/messages 後 dns 就會當掉,查詢其內容如下:原因是 Rotation 改變檔案的 inode,Rsyslog 嘗試去寫到舊的 inode。
    [root@dns ~]# head -n4 /var/log/messages
    Dec 21 03:17:01 dns kernel: imklog 4.6.2, log source = /proc/kmsg started.
    Dec 21 03:17:01 dns rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1496" x-info="http://www.rsyslog.com"] (re)start
    Dec 21 03:17:19 dns named[1004]: error (connection refused) resolving 'racetrackslots.com/A/IN': 139.175.10.20#53
    Dec 21 03:17:47 dns named[1004]: error (connection refused) resolving 'mirrors.s.3322.net/A/IN': 139.175.10.20#53
    
  2. 問題一解決方式:在 named 重啟之前先重新載入 rsyslog,以產生新的空的紀錄檔。
    [root@dns ~]# cat /etc/logrotate.d/named 
    /var/named/data/named.run {
        missingok
        create 0644 named named
        postrotate
            /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
            /sbin/service named reload  2> /dev/null > /dev/null || true
        endscript
    }
    
  3. 重新啟動 rsyslog
    [root@dns ~]# /etc/init.d/rsyslog restart
    


2018-01-11