3

On a Ubuntu 14.04 vps, my timezone is set to UTC/GMT.

root@Ubuntu:/# date 
Fri Mar 11 13:36:56 GMT 2016

root@Ubuntu:/# cat /etc/timezone 
Europe/London

root@Ubuntu:/# ls -l /etc/localtime 
lrwxrwxrwx 1 root root 33 Mar 11 13:20 /etc/localtime -> /usr/share/zoneinfo/Europe/London

However, my log files in /var/log are all 9 hrs ahead (Korea time?). E.g

root@Ubuntu:/# tail -3 /var/log/auth.log.1

Mar 11 22:27:05 Ubuntu sshd[18170]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.99.249.89 
Mar 11 22:27:07 Ubuntu sshd[18170]: Failed password for invalid user cstrike from 211.99.249.89 port 38066 ssh2
Mar 11 22:27:07 Ubuntu sshd[18170]: Connection closed by 211.99.249.89 [preauth]

This remains the case even after a service rsyslog restart and dpkg-reconfigure tzdata.

How do I get everything on the same timezone?

9

I suffered from the same problem and issued the commands dpkg-reconfigure tzdata and service rsyslog restart in succession on a 14.04 server. I then initiated an ssh connection whilst viewing auth.log with

tail -f /var/log/auth.log

Log messages from then on were correct, as may be seen in this snippet

Aug 16 09:02:40 myhost sshd[11913]: Accepted publickey ...
Aug 16 09:02:40 myhost sshd[11913]: pam_unix(sshd:session): opened ...
Aug 16 09:02:43 myhost sshd[11913]: pam_unix(sshd:session): closed ...
Aug 16 15:04:45 myhost sshd[12019]: Accepted publickey .... 
Aug 16 15:04:45 myhost sshd[12019]: pam_unix(sshd:session): opened ...
Aug 16 15:05:11 myhost sshd[12019]: pam_unix(sshd:session): closed ...

I see you did a tail of auth.log.1 (an older log file). Making the timezone changes does not modify an existing log file retroactively. Was that the problem perhaps?

2
  • 3
    service rsyslog restart save my day – Ninja Oct 10 '17 at 3:19
  • after doing the above steps i still had to restart apache2 for the logs to go to the right timezone: systemctl restart apache2 – user3892260 Jun 20 '19 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.