Solved

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

Posted on 2012-03-18
6
523 Views
Last Modified: 2012-04-05
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
Comment
Question by:shaunwingin
6 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 37735465
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
 

Author Comment

by:shaunwingin
ID: 37735559
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
 
LVL 44

Expert Comment

by:Darr247
ID: 37736194
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Expert Comment

by:1ly4me
ID: 37736885
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
 
LVL 10

Accepted Solution

by:
pfrancois earned 500 total points
ID: 37736943
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
 

Author Comment

by:shaunwingin
ID: 37736959
/var/lib/ntp/ntp.drift is blank
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now