# Why \`pbm \*\` is not using the server's timezone?

**URL:** <https://forums.percona.com/t/why-pbm-is-not-using-the-servers-timezone/9452>\
**Category:** Percona Backup for MongoDB\
**Created:** [February 26, 2021, 4:11pm UTC](https://forums.percona.com/t/why-pbm-is-not-using-the-servers-timezone/9452 "2021-02-26T16:11:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![feng.sian](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@feng.sian](https://forums.percona.com/u/feng.sian)\
**Post date:** [February 26, 2021, 4:11pm UTC](https://forums.percona.com/t/why-pbm-is-not-using-the-servers-timezone/9452/1 "2021-02-26T16:11:52Z")

</div>

Is there a way to make the `pbm logs` to honor the server’s timezone?  
This eases correlating the events shown there with the `journalctl -u pbm-agent`.

Example: the server (where the the `mongod` and `pbm-agent` are running) is on GMT-3. The `pbm` is also being run at GMT-3.

Here is how the `pbm logs` looks:

```auto
[feng.sian@DSAGIMOGDBSP01 ~]$ pbm logs
...
2021-02-26T12:50:22Z I [rs-dev-00/DSAGIMOGDBSP01.axabr.ad:27001] [backup/2021-02-26T12:50:05Z] backup started
2021-02-26T12:50:25Z I [rs-dev-00/DSAGIMOGDBSP01.axabr.ad:27001] [backup/2021-02-26T12:50:05Z] mongodump finished, waiting for the oplog
2021-02-26T12:50:30Z I [rs-dev-00/DSAGIMOGDBSP01.axabr.ad:27001] [backup/2021-02-26T12:50:05Z] backup finished
2021-02-26T12:51:27Z I [rs-dev-00/DSAGIMOGDBSP01.axabr.ad:27001] got command restore [name: 2021-02-26T12:51:27.166184056Z, backup name: 2021-02-25T18:43:59Z] <ts: 1614343887>
2021-02-26T12:51:27Z I [rs-dev-00/DSAGIMOGDBSP01.axabr.ad:27001] got epoch {1614343830 1}
2021-02-26T12:51:27Z I [rs-dev-00/DSAGIMOGDBSP01.axabr.ad:27001] [restore/2021-02-25T18:43:59Z] restore started
[feng.sian@DSAGIMOGDBSP01 ~]$ 

```

All these timestamps are on “Zulu TZ” - but the server is on GMT-3:

```auto
[feng.sian@DSAGIMOGDBSP01 ~]$ ls -ld /etc/localtime
lrwxrwxrwx. 1 root root 39 Dec 20 2019 /etc/localtime -> ../usr/share/zoneinfo/America/Sao_Paulo
[feng.sian@DSAGIMOGDBSP01 ~]$ 

```

and the `journalctl -u pbm-agent`:

```auto
[feng.sian@DSAGIMOGDBSP01 ~]$ journalctl -u pbm-agent
...
Feb 26 09:51:30 DSAGIMOGDBSP01 pbm-agent[107868]: 2021-02-26T09:51:30.612-0300 creating collection admin.pbmRUsers using option>
Feb 26 09:51:30 DSAGIMOGDBSP01 pbm-agent[107868]: 2021-02-26T09:51:30.629-0300 restoring admin.pbmRUsers from archive on stdin
Feb 26 09:51:30 DSAGIMOGDBSP01 pbm-agent[107868]: 2021-02-26T09:51:30.631-0300 using 10 insertion workers
Feb 26 09:51:31 DSAGIMOGDBSP01 pbm-agent[107868]: 2021-02-26T09:51:31.083-0300 restoring indexes for collection admin.pbmRUsers>
[feng.sian@DSAGIMOGDBSP01 ~]$

```

There, the timestamps are correctly localized to the server timezone.

---

<div class="post-metadata">

**Author:** ![Akira\_Kurogane](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/akira_kurogane/32/1280_2.png) [@Akira\_Kurogane](https://forums.percona.com/u/Akira_Kurogane)\
**Post date:** [February 28, 2021, 11:54pm UTC](https://forums.percona.com/t/why-pbm-is-not-using-the-servers-timezone/9452/2 "2021-02-28T23:54:22Z")

</div>

Hello.

It was a design decision to use UTC time. One key reason is to avoid encouraging user misunderstandings or mistakes when replica set nodes are in different timezones. This is a requirement for not just some but a lot of users.

Having said that though there is a logging function within the “mongodump” and “mongorestore” libraries that leaves the system logger with defaults, so those lines in the pbm-agent log are coming out with local time.

If we change anything it will be to replace the logger to get UTC everywhere.
