?
Solved

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

Posted on 2012-03-18
6
Medium Priority
?
541 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
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 1500 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

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 …
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

764 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