首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >chrony不记录我的ec2实例上的任何内容。

chrony不记录我的ec2实例上的任何内容。
EN

Server Fault用户
提问于 2019-03-07 14:58:11
回答 2查看 5.9K关注 0票数 3

我正在尝试从EC 2(Ubuntu18.04.2LTS)实例中收集时间守护进程的统计信息。我遵循了aws关于如何设置它的指南,它按预期运行。

我需要比较aws和我们使用的另一个服务提供者之间的时间同步差异,这就是为什么我启用了time登录。

但是它不会在/var/log/chrony文件夹中记录任何东西

这是我的配置:

代码语言:javascript
复制
server 169.254.169.123 prefer iburst

pool ntp.ubuntu.com        iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Uncomment the following line to turn logging on.
log tracking measurements statistics

# Log files location.
logdir /var/log/chrony


# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3

我已经检查了文件夹和所有内容的权限,但是没有日志文件。

希望你们能帮我

EN

回答 2

Server Fault用户

回答已采纳

发布于 2019-03-07 22:33:59

我刚刚通过以下操作验证了时间日志记录:

  1. 创建了一个默认的Ubuntu18.04 LTS EC2实例- AMI id: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20180912 (ami-07a3bd4944eb120a0)
  2. 安装时间:sudo apt install chrony
  3. /etc/chrony/chronyd.conf中的默认配置编辑为
    • 添加上面的配置中显示的AWS NTP源代码
    • 取消对log tracking ...行的注释

  4. 重新启动时间:sudo service chrony restart
  5. 确认日志正在工作:root@ip-172-31-1-97:# ls -la /var/log/chrony/共计32 drwxr-xr-x2 _chrony _chrony 4096 /7 22:20。drwxrwxr-x 10根syslog 4096 3月7日22:19。-rw-r-r-1 _chrony _chrony 10686 /7 22:22 measurements.log -rw-r-1 _chrony _chrony 4797 3月7 22:22 statistics.log -r-1 _chrony _chrony 1854年3月7:21 tracking.log
  6. 确认该公司正在联系其来源: root@ip-172-31-1-97:~# -n -n源210源数=9 MS名称/IP地址层民意调查到达LastRx最后样本LastRx ^* 169.254.169.123 3 377 48 +16 is +46 +/- 300 is ^- 91.189.94.4 2 7241 103 +934 is+957 +/-161 0ns ^- 91.189.91.157 2 35 39 +2471us+2471 +/- 153 0ns ^- 91.189.89.199 2 7 41 167 +1194 0ns+1203 +/- 169 0ns ^?2001:67c:1560:8003:C8 0 6 0- +0ns+0ns +/- 0NS ^- 129.250.35.250 2 6 6377 49 +914 48 +944 +/- 93ms ^- 61.68.38.238 3 377 49 -1395 48 -1366 +/- 59 48 ^- 203.23.237.200 2 6 377 48+2176 48+2176 +/- 41 48 ^- 150.101.217.196 2 6 377 48-5039 48-5009 +/- 76 48

因此,我对你的测试和我的测试之间的区别最好的猜测是:

  1. 您使用了一个非官方的Ubuntu18.04 AMI
  2. 您已经使用了一个非官方的编年史软件包,而不是仅仅安装了Ubuntu档案中的一个。
  3. 更改配置后,忘记重新启动
票数 3
EN

Server Fault用户

发布于 2019-03-07 16:24:28

您是否尝试过查看Chrony是否正在登录到systemd?尝试:

代码语言:javascript
复制
journalctl -u Chronyd.service
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/957211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档