Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ubuntu: change timezone to UTC does not affect the time of syslog?

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.

like image 226
Michael Avatar asked Apr 04 '14 03:04

Michael


People also ask

How do I change the timezone in syslog daemon?

To have the syslog daemon pick up the new time zone, use the command: 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.

How do I set the UTC time zone in Ubuntu?

How to Set Universal Time (UTC) in Ubuntu. UTC stands for Coordinated Universal Time and is used for scientific calculations and synchronizing between timezones across the globe. You can synchronize your system by entering the following command: timedatectl set–timezone UTC.

What do the time zone and system clock synchronized values mean?

The time zone and system clock synchronized values show that the new local time was updated successfully. Users of Ubuntu versions such as 16.04 or lower can set their timezones by reconfiguring the timezone and daylight saving time data or tzdata. It contains files documenting both current and historical transitions of time zones around the world.

How to check the current timezone in Linux?

Checking the Current Timezone timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems, including Ubuntu 20.04. To print the current system’s timezone invoke the timedatectl without any arguments:


2 Answers

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.

like image 177
andrewdotn Avatar answered Oct 13 '22 10:10

andrewdotn


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.

like image 29
takeoffjava Avatar answered Oct 13 '22 12:10

takeoffjava