Avatar of Shaun Wingrin
Shaun Wingrin
Flag for South Africa asked on

log file time and date different from linux system time and date???

Say, date returns 6 hours ahead of the date and time in the log files? Why and how can I correct it to log as system date?
LinuxLinux Distributions

Avatar of undefined
Last Comment
Shaun Wingrin

8/22/2022 - Mon
Tintin

Which particular log files are you referring to?   The ones controlled by syslog?

Also, which Linux distro are you using and what timezone is it set to?
Shaun Wingrin

ASKER
I actually solved it with this:
[root@messaging etc]# rm /etc/localtime
rm: remove regular file `/etc/localtime'? y
[root@messaging etc]# ln -s  /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
[root@messaging etc]# date
Sun Mar 18 23:22:03 SAST 2012
Darr247

Didn't work for me - that solution makes my clock 6 hours fast for some reason... the same symptom that's supposed to fix!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
1ly4me

try to install ntpd (network time protocol)
#yum install ntpd
and copy any ntp server from pool list, this should be in the file /etc/ntp.conf and check the time with ntpdate command
#ntpdate 0.centos.pool.ntp.org
this should return the correct time. If the times is matching,
start the ntp service,
#service ntpd start
#chkconfig --add ntpd
#chkconfig ntpd on
ASKER CERTIFIED SOLUTION
Pierre François

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Shaun Wingrin

ASKER
/var/lib/ntp/ntp.drift is blank