Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • Last Modified:

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?
0
shaunwingin
Asked:
shaunwingin
1 Solution
 
TintinCommented:
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?
0
 
shaunwinginAuthor Commented:
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
0
 
Darr247Commented:
Didn't work for me - that solution makes my clock 6 hours fast for some reason... the same symptom that's supposed to fix!
0
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

 
1ly4meCommented:
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
0
 
Pierre FrançoisSenior consultantCommented:
The date command returns the local time. The timestamp in the log files in in UTM time. It is completely logic that these value differ, except if you are in the GMT timezone.

The SAST (South African Standard Time) is GMT+2.

If you have ntpd running and you adjust the time in an incorrect way, the information contained in the file /var/lib/ntp/ntp.drift will become inconsistent. If the value contained in that file differs a lot from 1.000, your clock will become unstable and introduce crazy jumps in the elapsed time. Check this on your system.
0
 
shaunwinginAuthor Commented:
/var/lib/ntp/ntp.drift is blank
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now