RHEL Jenkins system logs (/var/log/jenkins/jenkins.log) timestamps displayed in UTC instead of EET

Hello,

First of all, it’s my first time here, so please be kind regarding anything missing or unclear. :slight_smile:

Jenkins setup:

cat /etc/os-release
NAME=“Red Hat Enterprise Linux”
VERSION=“8.9 (Ootpa)”
64bit

java -version
openjdk version “17.0.13” 2024-10-15 LTS
OpenJDK Runtime Environment (Red_Hat-17.0.13.0.11-1) (build 17.0.13+11-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.13.0.11-1) (build 17.0.13+11-LTS, mixed mode, sharing)

Jenkins 2.479.1 LTS

  • running directly, with no containers
  • no reverse proxy
  • installation done with RHEL RPM
  • both type of agents, JNLP (configured in the past, when they were supported) and SSH

I’ve been trying for a while to make /var/log/jenkins/jenkins.log display the timestamps in EET, just like the UI System Log (Dashboard → Manage Jenkins → System Log → All Jenkins Logs) does. No luck.

Just to make sure I am correctly understood, the issue is noticed when “tail -f /var/log/jenkins/jenkins.log” from OS CLI (timestamps are displayed in UTC), but not when the logs are being checked from Jenkins UI (timestamps are displayed in EET).

The rest of the OS logs (tail -f /var/log/messages) are shown with EET timestamps.

Environment time:
timedatectl
Local time: Mon 2024-11-11 13:48:31 EET
Universal time: Mon 2024-11-11 11:48:31 UTC
RTC time: Mon 2024-11-11 11:48:31
Time zone: Europe/Helsinki (EET, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

I’ve already tried the below, no change.

This issue is not related to the Jenkins 2.479.1 LTS I am reporting it on, it’s been there from before, but now, after I upgraded my test environment to the latest LTS in order to test a production environments upgrade, I decided to give it a try finding a solution/fix by asking here.

Any help/suggestion is much appreciated.

Regards,
jkr

I do not have an answer on how to make the logs timestamps in local time but in general you very much want UTC for any system logs.

There are several reasons for that:

  • you might have other folks from other timezones that need to look at the logs. UTC is universal so there is a lot less guessing of which timezone to convert from.
  • timezones with Daylight Saving time (summer/winter time) are very problematic for reliable timestamps. As you will either jump an hour or go back one hour. I used to work at a company that had a 1h outage every year on the DST jump, because it confused the internal timeouts until they switched their timestamps to UTC.

Your timestamps could, and should, record the UTC offset but that’s still less convenient than plain UTC as some tools might ignore the offset.

So if your logs are timestamping in UTC, that’s actually the best thing you can do. You can then very reliably parse the logs, and you can use tools to convert to your local time very reliably.

Of course you are completely free to set the times to be recorded as local time. I’m not able to give advice on how though.

Some links:

1 Like

Hello Stephane and thanks for your answer.

I agree with you, partially, but I think this configuration (if it exists) should be flexible, so I should be able to choose what timezone to be used when displaying the Jenkins system log timestamps.

As I mentioned, some other timestamps (/var/log/messages) have been displayed using EET timezone once the OS time settings have been updated to EET. That makes me think that maybe the same could be obtained for the Jenkins system log ones.

Regrads,
jkr

I understand that it might be more convenient for you, especially if everyone looking at these logs is in a single timezone.

Have you tried the instructions here? Change System Time Zone