Error on 2.4.3.beta1+3

Hello guys,

with the current update of zpush beta i get following error after the first logrotate.
I just checked why this happend and it seems with the latest release logrotate was changed from apache:apache to root:z-push.
At first this doesn’t seem to be error prone, but at least on CentOS 7 the log files are created with permission 644, which doesn’t allow further modifications through apache.

Version 2.4.3.beta1+3
FatalMisconfigurationException
The configured LOGFILE can not be modified.

Trace:
Array
(
    [0] => Array
        (
            [file] => /usr/share/z-push/index.php
            [line] => 45
            [function] => CheckConfig
            [class] => ZPush
            [type] => ::
            [args] => Array
                (
                )

        )

)

Hi mkoas,

I’ve just tested a fresh Z-Push 2.4.3beta1 installation on Centos 7 and Z-Push logs are created with 664 permissions which makes them writeable by apache (also after the logrotation).

I’ve also checked the code and we don’t change the logfiles to 644 anywhere.

Which Z-Push version did you have before?

Manfred

Hi Manfred,

i’m always on latest z-push version. Maybe this error occurred on the version before or while package upgrade.
I upgraded from z-push-common-2.4.2+0-104.1.noarch to z-push-common-2.4.3.beta1+3-198.1.noarch on 31 may.
After this everything worked just as long as no logrotate happend.

Now i reinstalled z-push (after deleting old files; even z-push.lr) and the z-push.lr after fresh install looks like this:

/var/log/z-push/*.log {
        size 1k
        create root z-push
        compress
        rotate 4
        su root z-push
}

If i execute logrotate:

log /var/log/z-push/z-push-error.log.5.gz doesn't exist -- won't try to dispose of it
renaming /var/log/z-push/z-push-error.log to /var/log/z-push/z-push-error.log.1
creating new /var/log/z-push/z-push-error.log mode = 0644 uid = 0 gid = 996
compressing log with: /bin/gzip
switching uid to 0 and gid to 996
rotating log /var/log/z-push/z-push.log, log->rotateCount is 4
dateext suffix '-20180601'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/z-push/z-push.log.4.gz to /var/log/z-push/z-push.log.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/z-push/z-push.log.4.gz does not exist
renaming /var/log/z-push/z-push.log.3.gz to /var/log/z-push/z-push.log.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/z-push/z-push.log.3.gz does not exist
renaming /var/log/z-push/z-push.log.2.gz to /var/log/z-push/z-push.log.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/z-push/z-push.log.2.gz does not exist
renaming /var/log/z-push/z-push.log.1.gz to /var/log/z-push/z-push.log.2.gz (rotatecount 4, logstart 1, i 1),
renaming /var/log/z-push/z-push.log.0.gz to /var/log/z-push/z-push.log.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/z-push/z-push.log.0.gz does not exist
log /var/log/z-push/z-push.log.5.gz doesn't exist -- won't try to dispose of it
renaming /var/log/z-push/z-push.log to /var/log/z-push/z-push.log.1
creating new /var/log/z-push/z-push.log mode = 0644 uid = 0 gid = 996
compressing log with: /bin/gzip
switching uid to 0 and gid to 996
switching euid to 0 and egid to 0
 ll /var/log/z-push/
total 13940
-rw-r--r--. 1 root   z-push        0 Jun  1 19:19 z-push-error.log
-rw-r--r--. 1 apache apache      522 Feb 20 18:42 z-push-error.log-20180221.gz
-rw-r--r--. 1 apache apache      499 Feb 28 20:06 z-push-error.log-20180301.gz
-rw-r--r--. 1 apache apache      551 Mar 25 20:32 z-push-error.log-20180326.gz
-rw-r--r--. 1 apache apache      898 May 22 19:25 z-push-error.log-20180531.gz
-rw-r--r--. 1 apache apache     2938 May 31 20:04 z-push-error.log.1.gz
-rw-r--r--. 1 root   z-push        0 Jun  1 19:19 z-push.log
-rw-r--r--. 1 apache apache   338488 Mar 26 04:01 z-push.log-20180326.gz
-rw-r--r--. 1 apache apache   428049 Mar 27 02:23 z-push.log-20180327.gz
-rw-r--r--. 1 apache apache   578162 Mar 28 02:29 z-push.log-20180328.gz
-rw-r--r--. 1 apache apache 11222574 May 31 04:00 z-push.log-20180531.gz
-rw-r--r--. 1 apache apache  1536902 Jun  1 19:07 z-push.log.1.gz
-rw-r--r--. 1 apache apache   137393 May 31 16:58 z-push.log.2.gz

And now i get the same error message as in my first post. I don’t know where our setup differs but i use an vanilla centos 7.5.
Only Kopano, Z-Push and Apache installed (even MariaDB is on another Host)
Maybe your logrotate didn’t actually rotate because of the size parameter?

Greetings
Markus

Hi Markus,

my test system:

[root@centos z-push]# rpm --query centos-release
centos-release-7-5.1804.el7.centos.2.x86_64

[root@centos z-push]# kopano-cli -V
8.5.9

Z-Push 2.4.3beta1+3.

/var/log/z-push:

[root@centos z-push]# ls -la
total 17
drwxrwx--- 2 root z-push   10 Jun  1 22:20 .
drwxr-xr-x 8 root root     19 Jun  1 17:55 ..
-rw-rw-r-- 1 root z-push    0 Jun  1 22:20 z-push-error.log
-rw-rw-r-- 1 root z-push   20 Jun  1 22:17 z-push-error.log.1.gz
-rw-rw-r-- 1 root z-push  146 Jun  1 20:35 z-push-error.log.2.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 20:33 z-push-error.log.3.gz
-rw-rw-r-- 1 root z-push 5415 Jun  1 22:20 z-push.log
-rw-rw-r-- 1 root z-push  829 Jun  1 22:18 z-push.log.1.gz
-rw-rw-r-- 1 root z-push 1083 Jun  1 20:36 z-push.log.2.gz
-rw-rw-r-- 1 root z-push  230 Jun  1 20:33 z-push.log.3.gz
[root@centos z-push]# logrotate --force /etc/logrotate.d/z-push.lr 
[root@centos z-push]# ls -la
total 14
drwxrwx--- 2 root z-push   12 Jun  1 22:21 .
drwxr-xr-x 8 root root     19 Jun  1 17:55 ..
-rw-rw-r-- 1 root z-push    0 Jun  1 22:21 z-push-error.log
-rw-rw-r-- 1 root z-push   20 Jun  1 22:20 z-push-error.log.1.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 22:17 z-push-error.log.2.gz
-rw-rw-r-- 1 root z-push  146 Jun  1 20:35 z-push-error.log.3.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 20:33 z-push-error.log.4.gz
-rw-rw-r-- 1 root z-push    0 Jun  1 22:21 z-push.log
-rw-rw-r-- 1 root z-push  920 Jun  1 22:20 z-push.log.1.gz
-rw-rw-r-- 1 root z-push  829 Jun  1 22:18 z-push.log.2.gz
-rw-rw-r-- 1 root z-push 1083 Jun  1 20:36 z-push.log.3.gz
-rw-rw-r-- 1 root z-push  230 Jun  1 20:33 z-push.log.4.gz

Then I accessed the /Microsoft-Server-ActiveSync page a couple of times to get things logged:

[root@centos z-push]# ls -la
total 20
drwxrwx--- 2 root z-push   12 Jun  1 22:21 .
drwxr-xr-x 8 root root     19 Jun  1 17:55 ..
-rw-rw-r-- 1 root z-push    0 Jun  1 22:21 z-push-error.log
-rw-rw-r-- 1 root z-push   20 Jun  1 22:20 z-push-error.log.1.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 22:17 z-push-error.log.2.gz
-rw-rw-r-- 1 root z-push  146 Jun  1 20:35 z-push-error.log.3.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 20:33 z-push-error.log.4.gz
-rw-rw-r-- 1 root z-push 5415 Jun  1 22:21 z-push.log
-rw-rw-r-- 1 root z-push  920 Jun  1 22:20 z-push.log.1.gz
-rw-rw-r-- 1 root z-push  829 Jun  1 22:18 z-push.log.2.gz
-rw-rw-r-- 1 root z-push 1083 Jun  1 20:36 z-push.log.3.gz
-rw-rw-r-- 1 root z-push  230 Jun  1 20:33 z-push.log.4.gz
[root@centos z-push]# logrotate --force /etc/logrotate.d/z-push.lr 
[root@centos z-push]# ls -la
total 13
drwxrwx--- 2 root z-push   12 Jun  1 22:21 .
drwxr-xr-x 8 root root     19 Jun  1 17:55 ..
-rw-rw-r-- 1 root z-push    0 Jun  1 22:21 z-push-error.log
-rw-rw-r-- 1 root z-push   20 Jun  1 22:21 z-push-error.log.1.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 22:20 z-push-error.log.2.gz
-rw-rw-r-- 1 root z-push   20 Jun  1 22:17 z-push-error.log.3.gz
-rw-rw-r-- 1 root z-push  146 Jun  1 20:35 z-push-error.log.4.gz
-rw-rw-r-- 1 root z-push    0 Jun  1 22:21 z-push.log
-rw-rw-r-- 1 root z-push  905 Jun  1 22:21 z-push.log.1.gz
-rw-rw-r-- 1 root z-push  920 Jun  1 22:20 z-push.log.2.gz
-rw-rw-r-- 1 root z-push  829 Jun  1 22:18 z-push.log.3.gz
-rw-rw-r-- 1 root z-push 1083 Jun  1 20:36 z-push.log.4.gz

Everything (KC, database, Z-Push, apache) is on the same system.

Could you also post your logrotate.conf?

Manfred

Like is said everything vanilla ;)

[root@kopano ~]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
[root@kopano ~]# rpm -q centos-release
centos-release-7-5.1804.el7.centos.2.x86_64
[root@kopano ~]# rpm -q logrotate
logrotate-3.8.6-15.el7.x86_64
[root@kopano ~]# ll /etc/logrotate.d/
total 20
-rw-r--r--. 1 root root  194 Apr 10 20:27 httpd
-rw-r--r--. 1 root root 1773 May 17 07:11 kopano
-rw-r--r--. 1 root root  224 May 14 14:09 syslog
-rw-r--r--. 1 root root  100 Apr 13 12:58 yum
-rw-r-----. 1 root root   93 Jun  1 19:34 z-push.lr

Just for your information. I don’t want to kill your weekend ;)
For me it works since i edited the su and create parameters to apache. It was the first thing i did before creating this thread.
I’m just curious about this issue.

Hi Markus,

@mkoas said in Error on 2.4.3.beta1+3:

Just for your information. I don’t want to kill your weekend ;)
For me it works since i edited the su and create parameters to apache. It was the first thing i did before creating this thread.
I’m just curious about this issue.

It’s strange nevertheless that I wasn’t able to reproduce it. The question remains if there’s something on your system or the test system and if we’ll get more reports like yours after the final release. And if there’s really an issue, it would be better if we’d manage to solve it before the final release.

Manfred

Hi Manfred,

Could you reproduce the issue?
Another thing i wonder:
Why writing with group instead of writing with user?
You know you could write with apache:root instead of using su in the current logrotate config
Your change in ZP-1431 was because of a message which said you shouldn’t write with group

Markus

Hi Markus,

@mkoas said in Error on 2.4.3.beta1+3:

Hi Manfred,

Could you reproduce the issue?

No, I was not able to reproduce it.

@mkoas said in Error on 2.4.3.beta1+3:

Another thing i wonder:
Why writing with group instead of writing with user?

Because we create the group during the installation if it doesn’t exist and so are sure it’s always available. The webserver user is different depending on the OS/webserver (apache, nginx, httpd, wwwrun). See also https://forum.kopano.io/topic/737/z-push-2-4-0-nginx-configuration-file/16.

Manfred

@mkoas

if you still got the proplem: in my setup i encountered a similar error (and z-push-clients wont be able to access the server “Error: Fatal misconfiguration: cant write to log file”)
the solution was changing the owner:

/var/log/z-push/*.log {
        size 1k
        create apache z-push
        compress
        rotate 4
}

ls -lisah /var/log/z-push/

135245 4,0K drwxr-x---   2 apache z-push 4,0K  7. Jun 03:19 .
131783 4,0K drwxr-xr-x. 20 root   root   4,0K  5. Jun 10:13 ..
142303 624K -rw-r--r--   1 apache z-push 619K  7. Jun 09:16 z-push-error.log
150309  48K -rw-r--r--   1 apache z-push  46K  6. Jun 02:36 z-push-error.log-20180606.gz
149790  48K -rw-r--r--   1 apache z-push  47K  7. Jun 02:21 z-push-error.log-20180607.gz
142020 624K -rw-r--r--   1 apache z-push 619K  7. Jun 09:16 z-push.log
150606  48K -rw-r--r--   1 apache z-push  46K  6. Jun 02:36 z-push.log-20180606.gz
150565  48K -rw-r--r--   1 apache z-push  47K  7. Jun 02:21 z-push.log-20180607.gz

with this it works fine

regards
Coffee_is_life

@coffee_is_life i bet you didn’t exactly read all posts because i already mentioned i solved IT for me ;)
But thanks anyway because the thought counts.

@Manfred you got a solution?
If not i think you should change the “create” line in the logrotate config file like that “create 664 root z-push”
I think this would be the best solution

Hi Markus,

I’ve created a JIRA issue to address this: https://jira.z-hub.io/browse/ZP-1436. I guess it will be the solution you suggested.

Manfred

Hi @mkoas ,

this should be fixed in the pre-final repo now. Z-Push 2.4.3 beta1+6 contains the fix. Give it a try if this fixes the issue for you.

Manfred

@manfred i tried this now and this works for me