Solved

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

Posted on 2012-03-18
6
531 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

680 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