1

Topic: smtp log time

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.2 MARIADB edition.
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version: ubuntu 18.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySql
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
iRedMail    1.2
iRedAdmin-Pro    4.3 (MySQL)

大家好!
我的发送邮件时间,(会话时间及出站SMTP会话时间)跟 Log 发送时间不一样,Log 时间才准。我有看系统时间, log time 像local time, 其他两个像universal time, 请问要怎么改成local time. 谢谢!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: smtp log time

是在 iRedAdmin-Pro 里看的时间么?管理员的 Preferences 页面里的时区是否设置正确?

3 (edited by tianbao.huang 2020-04-23 13:56:42)

Re: smtp log time

你好!
在 iRedmail Pro 看的, 里面的 logs 时间跟 sessions 时间不一样,用户时间正确。
现在要改的是 sessions 时间。

4

Re: smtp log time

# timedatectl
                      Local time: Thu 2020-04-23 14:25:45 +07
                  Universal time: Thu 2020-04-23 07:25:45 UTC
                        RTC time: Thu 2020-04-23 07:25:45
                       Time zone: Asia/Ho_Chi_Minh (+07, +0700)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

我知道问题在哪里, logs 时间跟 Localtime 同步,是正确。 smpt sessions 跟universal time 同步, 请问现在怎么改 smtp sessions time 跑服务器 local time.
谢谢!

5

Re: smtp log time

确实是 iRedAdmin-Pro 的 bug。这里是 patch 用于修复这个问题:

diff --git a/templates/default/macros/iredapd.html b/templates/default/macros/iredapd.html
index 1db90e2e..530b66d0 100644
--- a/templates/default/macros/iredapd.html
+++ b/templates/default/macros/iredapd.html
@@ -409,7 +409,7 @@
                     {% set encryption_protocol = row.get('encryption_protocol', '') |e %}
 
                     <tr>
-                        <td data-sort-value="{{ row['time_num'] |e }}">{{ row['time'] | utc_to_timezone }}</td>
+                        <td data-sort-value="{{ row['time_num'] |e }}">{{ row['time'] | utc_to_timezone(timezone=session.get('timezone')) }}</td>
                         <td><a href="{{ ctx.homepath }}/activities/smtp/sessions/outbound/client_address/{{ client_address }}">{{ client_address }}</a></td>
                         <td><a href="{{ ctx.homepath }}/activities/smtp/sessions/outbound/sasl_username/{{ sasl_username }}">{{ sasl_username }}</a></td>
                         <td><a href="{{ ctx.homepath }}/activities/smtp/sessions/outbound/sender/{{ sender }}">{{ sender }}</a></td>
@@ -448,7 +448,7 @@
                 {% set action = row.get('action', '') |e %}
 
                 <tr>
-                    <td data-sort-value="{{ row['time_num'] |e }}">{{ row['time'] | utc_to_timezone }}</td>
+                    <td data-sort-value="{{ row['time_num'] |e }}">{{ row['time'] | utc_to_timezone(timezone=session.get('timezone')) }}</td>
                     <td><a href="{{ ctx.homepath }}/activities/smtp/sessions/client_address/{{ client_address }}">{{ client_address }}</a></td>
                     <td><a href="{{ ctx.homepath }}/activities/smtp/sessions/sasl_username/{{ sasl_username }}">{{ sasl_username }}</a></td>
                     <td><a href="{{ ctx.homepath }}/activities/smtp/sessions/sender/{{ sender }}">{{ sender }}</a></td>

6

Re: smtp log time

我改好了, 谢谢!