10

I changed the time zone of my server (Ubuntu 12.04) to UTC via:

echo 'UTC' > /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata

When running date, I can see the time is now in UTC. However, on /var/log/syslog, it still displays the time with the previous setup timezone and not UTC. Why ? How to make it take effect on the whole system? Reboot?

Thanks.

Michael
  • 8,357
  • 20
  • 58
  • 86

2 Answers2

26

To have the syslog daemon pick up the new time zone, use the command:

sudo service rsyslog restart

I found the name of the service to restart with:

ls /etc/init.d/*log*

In general you will have to restart every process on the system that you want to see the new timezone. If there’s only one or two, like syslog, that you care about, then you can restart them individually, but you’re probably better off rebooting and getting everything consistent.

andrewdotn
  • 32,721
  • 10
  • 101
  • 130
  • Odd that `rsyslog` accepts SIGHUP, presumably to pick up config changes, but it doesn't pick up the new timezone. That sounds like a bug or an oversight to me. Sending SIGHUP is usually preferable over restarting the service, but indeed doesn't help in this case. – CivFan Jan 28 '15 at 17:57
4

To switch to UTC, simply execute sudo dpkg-reconfigure tzdata, scroll to the bottom of the Continents list and select Etc; in the second list, select UTC. If you prefer GMT instead of UTC, it's just above UTC in that list.

takeoffjava
  • 504
  • 4
  • 15