我在 CentOS7 上安装了 rsyslog-8.26.0、loganalyzer-4.1.5 和 MongoDB 3.4.4。MongoDB 以 UTC 存储所有日期和时间,我可以在 Loganalyzer 上看到数据,也可以看到 UTC。
有什么想法可以更改本地时区吗?
在输出显示时更改 MongoDB 默认时区或在 Loganalyzer 上转换时区?
我在 CentOS7 上安装了 rsyslog-8.26.0、loganalyzer-4.1.5 和 MongoDB 3.4.4。MongoDB 以 UTC 存储所有日期和时间,我可以在 Loganalyzer 上看到数据,也可以看到 UTC。
有什么想法可以更改本地时区吗?
在输出显示时更改 MongoDB 默认时区或在 Loganalyzer 上转换时区?
我发现时区行在 php.ini 上有注释
;date.timezone =
php info 说 默认时区 UTC
php.ini 时区更改如下
date.timezone = "Australia/Melbourne"
并重新启动 HTTPD
现在我可以看到我的时区的所有日志
您可以使用下面的 mongo 模式方法或在服务器端设置默认时区
tableschema.pre('save', function (next) {
//You can store timezone according to input and use that for conversion
var timezone=this.timezone;
this.date=date // converted date here using timezone
next();
}
最好是在输出显示时在 Loganalyzer 上转换时区,它将根据客户端机器支持多个时区