Change the MongoDB log timestamp from UTC

Hello together,
my name is Gregor from Germany and I have a question regarding timestamps. MongoDB stores the LogFiles in collections with a timestamp in UTC. Is there a way to manipulate this timestamp so that directly when the log is created the timestamp for my timezone is used?

Greetings from Germany and thanks in advance for the help

1 Like

Welcome to the MongoDB Community @Gregor_Wachter !

Can you provide some more details on your environment:

  • version of MongoDB server
  • host O/S and version
  • command you are using to start mongod
  • your local timezone (for example, via output of date on Linux)

By default the MongoDB server should use the local server timezone for logging (iso8601-local format) per systemLog.timeStampFormat.

If your host environment is set to something other than UTC, I would check your MongoDB configuration file to see if the timeStampFormat has perhaps been set to iso8601-utc.


Thanks for the quick reply
I am using MongoCommunity 4.2 locally on a Windows 10 PC. There is nothing in the MongoDB configuration regarding the timestamp format.
In the local collection startup_log of the database I get the startTimeLocal in addition to the startTime which is in the correct timezone. Is there any way to manipulate the timestamp for events in a specific database? I have created a database that stores data on a regular basis. Since I export this data from the database later, the correct timestamp would be particularly relevant for me here. My timezone is Germany, Berlin with +0200 compared to UTC