LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-30-2009, 04:55 AM   #1
falc410
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Rep: Reputation: 0
syslog time wrong - but date returns the correct time?


I have a weird problem with two RedHat 5 machines.

When I type date I get the correct time returned, but when I check the syslog all the times are one hour off.
I have searched the forums but I didn't really find a solution. When I create a new file, it also has the correct time, so it really only appears wrong in all the log files under /var/log which is very very annoying!

Now I have a ntp server configured and I think the hardware clock is fine, maybe it is a timezone problem, but I'm not sure.

I'm located in Germany, so that should be GMT+1.

The only thing I found which has anything to do with the timezone is /etc/sysconfing/clock and it looks like this:

ZONE="UTC"
UTC=true
ARC=false

I don't know if these are the correct values or not. Any help is appreciated.
 
Old 01-30-2009, 06:55 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Are you confusing the system timestamps (UTC) with your local time? UNIX has historically used UTC for file timestamps (and almost everything else). Individual users can set their time zone on a per-process basis, so you can run multiple instances of 'pingus' each with a different time zone. Using local times to mark files etc just doesn't make any sense on any *NIX system. Even before UNIX, many computer applications (bank transactions, airline tickets, etc) involved multiple users from all over the planet performing operations on the computer. If someone updated data, how do you know when the last change was made? Simple - use a single time (UTC) for all transactions. If a user wanted to see results displayed in their own time zone, all they had to do was set the time zone appropriately and any timezone-aware program would adjust what the user sees.
 
Old 01-30-2009, 07:05 AM   #3
falc410
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Well I thank you for the explanation but I did only understand half of it.

I will try to explain my problem once more. Right now it is 2 pm in Germany. I log in to the server and run the following commands:

[root@nagios2 nagios]# date
Fri Jan 30 14:01:06 CET 2009
[root@nagios2 nagios]# wall test

Broadcast message from root (pts/0) (Fri Jan 30 13:01:18 2009)

Do you see the difference?
Funny thing is, depending on the software if I check /var/log/messages the timestamp is either correct or one hour off:

Jan 30 14:01:18 nagios2 wall[1636]: wall: user root broadcasted 1 lines (6 chars)

This is the correct time, but other software is sometimes one hour off, this causes quite a few problems. Here is a copy and paste of my /var/log/messages:

Quote:
Jan 30 12:07:54 nagios2 pengine: [3758]: info: process_pe_message: Configuration WARNINGs found during PE processing. Please
run "crm_verify -L" to identify issues.
Jan 30 13:08:20 nagios2 haclient: on_event:evt:cib_changed
Jan 30 13:08:20 nagios2 haclient: on_event:evt:cib_changed
Jan 30 13:08:20 nagios2 haclient: on_event: from message queue: evt:cib_changed
Jan 30 12:14:51 nagios2 cib: [3177]: info: cib_stats: Processed 104 operations (5000.00us average, 0% utilization) in the las
t 10min
Do you see what is happening? All those entries were in a timeframe of 7 minutes, but the logfiles recorded it with different hours, making the logfiles quite unreadable since you never can be sure what time it really was and you can't be sure if this happened in the right order or not.
 
Old 05-27-2010, 12:54 AM   #4
jives11
LQ Newbie
 
Registered: May 2010
Posts: 5

Rep: Reputation: 0
I have the same issue.

I have a Mybookworld device running Linux and a laptop running Ubuntu Karmic Koala NBR which uses rsync to backup to the mybook at night. Works great

In the var/log/messages below you can see timed events happening - I run a script every 15 minutes to log the disk temperature in the Mybook. Then when the rsyncd entries appear they are dated 1 hour earlier, despite both the mybook and the laptop having the correct time and running ntp. 1 hour difference looks like a DST thing to me, but I cannot see where it's creeping in from


May 27 00:00:01 MyBookWorld cron.notice crond[1001]: USER root pid 31049 cmd date +%m%d%H%M%Y.%S > /var/lib/now
May 27 00:00:01 MyBookWorld cron.notice crond[1001]: USER root pid 31050 cmd /root/temp_log.sh >> /tmp/temperature.log
May 27 00:15:01 MyBookWorld local3.info rsyncd[31058]: connect from helen-laptop.lan
May 26 23:15:01 MyBookWorld local3.info rsyncd[31058]: rsync to helen-backup/ from JONATHAN@helen-laptop.lan
May 26 23:15:01 MyBookWorld local3.info rsyncd[31058]: receiving file list
May 27 00:15:01 MyBookWorld cron.notice crond[1001]: USER root pid 31060 cmd /root/temp_log.sh >> /tmp/temperature.log
May 26 23:15:01 MyBookWorld local3.info rsyncd[31058]: helen/
May 26 23:15:02 MyBookWorld local3.info rsyncd[31058]: helen/.config/google-chrome/
May 26 23:15:06 MyBookWorld local3.info rsyncd[31058]: helen/.config/google-chrome/Default/
May 26 23:16:10 MyBookWorld local3.info rsyncd[31058]: helen/.config/gtk-2.0/
May 26 23:16:13 MyBookWorld local3.info rsyncd[31058]: helen/.gconf/
May 26 23:16:22 MyBookWorld local3.info rsyncd[31058]: helen/.gconf/apps/nautilus/preferences/
May 26 23:16:23 MyBookWorld local3.info rsyncd[31058]: helen/.gconf/apps/update-manager/
May 26 23:16:23 MyBookWorld local3.info rsyncd[31058]: helen/.gconfd/
May 26 23:16:24 MyBookWorld local3.info rsyncd[31058]: helen/.gnome2/evince/
May 26 23:16:26 MyBookWorld local3.info rsyncd[31058]: helen/.kde/share/config/
May 26 23:16:26 MyBookWorld local3.info rsyncd[31058]: helen/.local/share/gvfs-metadata/
May 26 23:16:59 MyBookWorld local3.info rsyncd[31058]: helen/.openoffice.org/3/
May 26 23:16:59 MyBookWorld local3.info rsyncd[31058]: helen/.openoffice.org/3/user/backup/
May 26 23:16:59 MyBookWorld local3.info rsyncd[31058]: helen/.openoffice.org/3/user/registry/data/org/openoffice/Office/
May 26 23:16:59 MyBookWorld local3.info rsyncd[31058]: helen/.openoffice.org/3/user/uno_packages/cache/
May 26 23:16:59 MyBookWorld local3.info rsyncd[31058]: helen/Documents/
May 26 23:17:00 MyBookWorld local3.info rsyncd[31058]: helen/Downloads/

May 26 23:17:08 MyBookWorld local3.info rsyncd[31058]: sent 245623 bytes received 68083145 bytes total size 13103844678
May 27 00:30:02 MyBookWorld cron.notice crond[1001]: USER root pid 31076 cmd /root/temp_log.sh >> /tmp/temperature.log
May 27 00:45:01 MyBookWorld cron.notice crond[1001]: USER root pid 31091 cmd /root/temp_log.sh >> /tmp/temperature.log

Last edited by jives11; 05-27-2010 at 12:55 AM.
 
Old 11-08-2013, 03:34 AM   #5
vipspark
LQ Newbie
 
Registered: Jan 2005
Location: New Delhi
Posts: 17

Rep: Reputation: 0
restart syslogd service.. I hope this will help you.
 
Old 11-09-2013, 04:54 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It looks like /etc/sysconfing/clock is likely incorrect. This should be specifying the local time for the system - and instead it is defining UTC.

You can look here for some information about it:

http://www.centos.org/docs/5/html/5....fig-clock.html

I THINK you need a "zone" entry that defines your local time zone. After that, syslog should pick that up and use it to record time stamps.
 
Old 08-01-2019, 01:33 PM   #7
jverruckt
LQ Newbie
 
Registered: Aug 2019
Posts: 1

Rep: Reputation: Disabled
Actually the answer is not complicated in my case.

Originally I placed symbolic link as:

[probe@centos7-16 ~]$ ls -l /etc/localtime
lrwxrwxrwx. 1 root root 39 Jul 20 21:27 /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles

It works correct when I type "date" on the shell but doesn't show the correct time in /var/log/messages, so what did I change:

[root@centos7-16 ~]# rm /etc/localtime
rm: remove symbolic link ‘/etc/localtime’? y
[root@centos7-16 ~]# ln -s ../usr/share/zoneinfo/America/Los_Angeles /etc/localtime
[root@centos7-16 ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 41 Aug 1 11:20 /etc/localtime -> ../usr/share/zoneinfo/America/Los_Angeles
[root@centos7-16 ~]# systemctl restart rsyslog


and /var/log/messages stated to show the correct time.

The command below is useful but in that case was showing identical information prior and after the change. Giving it fyi.

[root@centos7-16 ~]# timedatectl status
Local time: Thu 2019-08-01 11:21:59 PDT
Universal time: Thu 2019-08-01 18:21:59 UTC
RTC time: Thu 2019-08-01 18:21:59
Time zone: America/Los_Angeles (PDT, -0700)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-10 01:59:59 PST
Sun 2019-03-10 03:00:00 PDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-11-03 01:59:59 PDT
Sun 2019-11-03 01:00:00 PST
 
Old 04-05-2020, 10:04 PM   #8
pelodark
LQ Newbie
 
Registered: Apr 2020
Location: Santa Ana, CA, US
Distribution: Debian 10
Posts: 2

Rep: Reputation: Disabled
Thumbs up Same problem in Debian 10

Quote:
Originally Posted by jverruckt View Post
Actually the answer is not complicated in my case.

Originally I placed symbolic link as:

[probe@centos7-16 ~]$ ls -l /etc/localtime
lrwxrwxrwx. 1 root root 39 Jul 20 21:27 /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles

It works correct when I type "date" on the shell but doesn't show the correct time in /var/log/messages, so what did I change:

[root@centos7-16 ~]# rm /etc/localtime
rm: remove symbolic link ‘/etc/localtime’? y
[root@centos7-16 ~]# ln -s ../usr/share/zoneinfo/America/Los_Angeles /etc/localtime
[root@centos7-16 ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 41 Aug 1 11:20 /etc/localtime -> ../usr/share/zoneinfo/America/Los_Angeles
[root@centos7-16 ~]# systemctl restart rsyslog


and /var/log/messages stated to show the correct time.

The command below is useful but in that case was showing identical information prior and after the change. Giving it fyi.

[root@centos7-16 ~]# timedatectl status
Local time: Thu 2019-08-01 11:21:59 PDT
Universal time: Thu 2019-08-01 18:21:59 UTC
RTC time: Thu 2019-08-01 18:21:59
Time zone: America/Los_Angeles (PDT, -0700)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-10 01:59:59 PST
Sun 2019-03-10 03:00:00 PDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-11-03 01:59:59 PDT
Sun 2019-11-03 01:00:00 PST

Thank you...fix'd same problem in Debian 10
 
  


Reply

Tags
date, syslog, time, timezone



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System time correct for root, wrong for normal user? dx0r515t Slackware 2 07-21-2006 05:30 PM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM
time and date not correct, after reboot vasanthraghavan Linux - General 4 03-10-2005 11:55 AM
Date and time always wrong snatale1 Linux - General 6 12-13-2003 10:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration