Log timestamp differs from system time

My system's timezone is set to PST and the date command reflects this, however my log files all correspond to three hours ahead, or EST. I'm running CentOS 6.0 and have altered my time zone settings a couple times in the past.

Browsed around a decent bit, but didn't uncover anything that answered my question/solved the problem. Any information and help is appreciated!

2 Replies

Is your system's timezone set to PST, or is it just for your user? Some methods of changing the timezone only changes it for the current user.

If you changed your system's timezone, did you reboot since then? Or at least restart some services? Some programs might keep using the timezone they saw when they started up.

On a related note, everything on a server should be UTC/GMT. It's not fun trying to read log files during those two hours a year when all U.S. timezones suddenly change!

Edit: Figured it out, ended up being really simple. Thanks for pointing me in the right direction, hybinet. In case future new users run into the same trouble, just had to use the following command:

service rsyslog restart

I believe it's set to PST on the system. I used the following command to set it:

ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime

I haven't rebooted since I changed it, I only restarted the Apache service since that was my main reason for changing it. Which other services would need to be restarted?

Thanks for the tip regarding UTC/GMT as well! I'll keep it in mind!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct