我需要使用基于 OpenVZ 的映像查看 CentOS 7 VM 的 cron 日志的准确时间戳。该机器还启用了 SCL,因为红帽提供开箱即用的古董软件。像我们这样的用户必须做一些特别的事情才能进入良好的状态。
目前,日志条目具有一些随机时间时间戳,并且随着日志轮换期间时间的推移,偏差会更大。在下面的日志示例中,今天是 2018 年 12 月 21 日,但尾部日志条目的标记为 12 月 16 日。第一个条目和最后一个条目之间是带有随机时间戳的条目。
这是一个较早的问题我们必须解决这个问题,但我不确定它是否会导致这个问题。我已经安装了 NTP 客户端,并且每四个小时与 NIST 时间服务器同步一次。
有什么问题以及如何解决它?
这是日志示例。这是单调递增的采样。我只是挑选了机器决定开始随机条目的部分。
# cat /var/log/cron-20181216
# <first two entries below this line>
Dec 11 17:40:02 ftpit CROND[330]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 11 17:50:01 ftpit CROND[536]: (root) CMD (/usr/lib64/sa/sa1 1 1)
...
Dec 12 00:00:01 ftpit CROND[5589]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 12 00:10:01 ftpit CROND[5703]: (root) CMD (/usr/lib64/sa/sa1 1 1)
...
Dec 12 10:20:04 ftpit CROND[14133]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 12 10:21:43 ftpit crond[182]: (CRON) INFO (Shutting down)
...
Dec 12 10:22:10 ftpit crond[182]: (CRON) INFO (running with inotify support)
Apr 17 00:00:01 ftpit CROND[10377]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Aug 19 14:40:01 ftpit CROND[22522]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb 21 11:30:01 ftpit CROND[20076]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 28 23:50:02 ftpit CROND[23797]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jun 8 04:50:06 ftpit CROND[5513]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 28 23:53:01 ftpit CROND[23816]: (root) CMD (/usr/lib64/sa/sa2 -A)
Feb 21 11:40:04 ftpit CROND[20398]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 29 00:00:07 ftpit CROND[23863]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Apr 17 00:12:01 ftpit CROND[10645]: (root) CMD (run-parts /etc/cron.hourly)
Apr 17 00:12:01 ftpit run-parts(/etc/cron.hourly)[10645]: starting 0yum-hourly.cron
Jun 8 05:00:01 ftpit CROND[5638]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 29 00:10:04 ftpit CROND[23913]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb 21 11:50:13 ftpit CROND[20790]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jun 8 05:10:01 ftpit CROND[5754]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jun 8 05:12:01 ftpit CROND[5834]: (root) CMD (run-parts /etc/cron.hourly)
Jun 8 05:12:01 ftpit run-parts(/etc/cron.hourly)[5834]: starting 0yum-hourly.cron
...
Dec 16 04:30:01 ftpit CROND[30820]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 16 04:40:03 ftpit CROND[30981]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 16 04:50:03 ftpit CROND[31096]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 16 05:00:01 ftpit CROND[31252]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 16 05:00:14 ftpit run-parts(/etc/cron.daily)[31270]: finished 0yum-daily.cron
Dec 16 05:00:14 ftpit run-parts(/etc/cron.daily)[30614]: starting certwatch
Dec 16 05:00:15 ftpit run-parts(/etc/cron.daily)[31287]: finished certwatch
Dec 16 05:00:15 ftpit run-parts(/etc/cron.daily)[30614]: starting gdrive-backup
Dec 16 05:00:18 ftpit run-parts(/etc/cron.daily)[31303]: finished gdrive-backup
Dec 16 05:00:18 ftpit run-parts(/etc/cron.daily)[30614]: starting logrotate
# <last 10 entries are above this line>