Hello. Help please , updated to 9 owncloud server. Now it does not work logtimezone (config.php). And now fail2ban not bans . Since time does not match. What to do?
When recording a log does not change the time zone
When recording logs must change the time zone
Operating system:
ubuntu server 14.01
Web server:
apache2
Database:
mysql
PHP version:
php 7
ownCloud version: (see ownCloud admin page)
owncloud server 9
I can confirm that I'm seeing the same thing here. The LogTimeZone setting in the config.php does not appear to affect the actual timestamps in the logs, which breaks fail2ban.
I am seeing the same behavior. Log time stamps do not reflect the timezone set.
I can confirm the problem also.
{"reqId":"rRw4WfPoRl0DscSMS8mb","remoteAddr":"185.65.xxx.xxx","app":"core","message":"Login failed: 'User' (Remote IP: '185.65.xxx.xxx')","level":2,"time":"2016-03-12T09:30:18+00:00"}
root@nas:/home/nas# date
Sat Mar 12 10:30:51 CET 2016
root@nas:/home/nas# cat /var/www/owncloud/config/config.php | grep time
'logtimezone' => 'Europe/Berlin',
root@nas:/home/nas#
I decided this issue . One possible solution is: file owncloud \ lib \ private \ log \ owncloud.php replace strings
$time = DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""), $timezone);
if ($time === false) {
$time = new DateTime(null, $timezone);
}
on
$time = new DateTime(null, $timezone);
Thx @StrannikST for the temp solution
You鈥檙e welcome
I can confirm this issue, too. It is caused by commits d0464bf7724480d18d1f0b881acf83849d83b72d, 7fce06b3f32ec564f129bf2a361d6ee37096e03b.
The fix by StrannikST from above reverts these commits.
The problem seems to be caused by the function 'DateTime::createFromFormat', which has the following constraint:
The timezone parameter and the current timezone are ignored when the time parameter either contains a UNIX timestamp (e.g. 946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00).
Source: https://secure.php.net/manual/en/datetime.createfromformat.php
Remove the timezone parameter from "DateTime::createFromFormat" because it has no effect and just set timezone afterwards.
$time = DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""));
$time ? $time->setTimezone($timezone) : $time = new DateTime(null, $timezone);
That's it!
CC @schnidrig
This is the PR in question https://github.com/owncloud/core/pull/18978
@Phiber2000 looks good, mind turning it into a PR?
PS: but dont use inline if for something like that.
@nickvergessen I'll create the PR in some minutes, using if-else blocks in code.
https://github.com/owncloud/core/pull/23225 was merged
Thank you for posting the fix for this. It has been driving me insane.
Is this backported?
Yes it is: #23240
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@nickvergessen I'll create the PR in some minutes, using if-else blocks in code.