已停止记录到 /var/log/messages。如何重新打开它?

已停止记录到 /var/log/messages。如何重新打开它?

在疯狂尝试解决时间同步问题时,我不知何故一定关闭了一些(但不是全部)日志记录。/var/log/messages 结束了最后一个事件,并且 journalctl -eu chronyd 没有显示任何新条目,尽管服务正在运行。重启后这种情况仍然存在。总结:

  • 有点奇怪:chronyd 没有记录任何内容

  • 其他服务正在记录

  • 真的很奇怪,也有点吓人:天知道我昨晚做了什么, /var/log/messages 却没有任何变化。

    $ date
    Sat May  1 09:51:07 CEST 2021
    $ ls -l /var/log/messages
     -rw-------. 1 root root 16252618 Apr 30 18:07 /var/log/messages
     $ journalctl -eu chronyd | tail -n 2
     Apr 30 18:06:35 my.host systemd[1]: Stopping NTP client/server...
     Apr 30 18:06:35 my.host systemd[1]: Stopped NTP client/server.
     $ sudo systemctl status chronyd
     ● chronyd.service - NTP client/server
        Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
        Active: active (running) since Sat 2021-05-01 09:34:07 CEST; 18min ago
          Docs: man:chronyd(8)
                man:chrony.conf(5)
       Process: 804 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
       Process: 731 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)
      Main PID: 741 (chronyd)
         Tasks: 1
        CGroup: /system.slice/chronyd.service
                └─741 /usr/sbin/chronyd
    
     May 01 09:34:06 my.host systemd[1]: Starting NTP client/server...
     May 01 09:34:06 my.host chronyd[741]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
     May 01 09:34:06 my.host chronyd[741]: Frequency -5.091 +/- 0.244 ppm read from /var/lib/chrony/drift
     May 01 09:34:07 my.host systemd[1]: Started NTP client/server.
     May 01 09:37:21 my.host chronyd[741]: Selected source xxx.xxx.xxx.xxx
     $
       $ systemctl status systemd-journald
     ● systemd-journald.service - Journal Service
    Loaded: loaded (/usr/lib/systemd/system/systemd-journald.service; static; vendor preset: disabled)
    Active: active (running) since Sat 2021-05-01 09:34:05 CEST; 26min ago
      Docs: man:systemd-journald.service(8)
            man:journald.conf(5)
      Main PID: 512 (systemd-journal)
    Status: "Processing requests..."
     Tasks: 1
    CGroup: /system.slice/systemd-journald.service
            └─512 /usr/lib/systemd/systemd-journald
    

答案1

问题已经自行解决。它发生在我的系统时间出现不稳定、大幅跳跃的时候。这些问题现在已得到解决,rsyslogd 正在运行并正确记录。系统时间的前后变化可能使 rsyslogd(和其他服务)感到不安。

相关内容