Timestamp format on localhost logs (self-hosted)?

jnte3355
Tera Contributor

Hello,

 

Is there a possibility to change the timestamps in node logs (localhost_log) to be in UTC, or in a format that includes UTC offset (e.g. iso 8601)?

 

Currently our self-hosted instance is recording timestamps in local time, and without any time zone indication. This poses a challenge when logs are forwarded for further processing and analysis since the forwarder or receiver would need to convert from local time and need to take into account time zone and DST flag on the app server sending the logs.

 

We are using rsyslog service for forwarding the logs - we can do some conversion there, but I did not yet find a straightforward and efficient way to add timezone information. 

 

Thanks,

Johan

1 ACCEPTED SOLUTION

akanksha1pa
Tera Expert

1. Change System Time to UTC

  • Set the application server’s system time to UTC.

  • This ensures all logs are written in UTC, even if they don’t include an offset.

  • Simple and effective, but affects all system-level timestamps.

View solution in original post

4 REPLIES 4

akanksha1pa
Tera Expert

1. Change System Time to UTC

  • Set the application server’s system time to UTC.

  • This ensures all logs are written in UTC, even if they don’t include an offset.

  • Simple and effective, but affects all system-level timestamps.

I initially thought that this was out of the question because of all the potential other effects it might have on the system as a whole, however I am now checking KB article KB0957666 on installation and I can see that this is exactly what ServiceNow recommends as well, which is a huge factor:
"Operating system clock should be set to UTC"

Therefore I will regard this as the primary option for now. Thank you very much!

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @jnte3355 ,

 

If your instance allows you to edit the Logback configuration usually logback.xml you might be able to change the timestamp pattern in the logging layout. it may be a risky move though...

Look for a section like this:

 

<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

This is more along the lines of what I had in mind opening the thread - something affecting only the Glide nodes, not the system (server). I will keep this in mind as well (after option "Change System Time" by @akanksha1pa), but I would still need to find out exactly where and how to place such a file.
Thank you very much!