zpush rotate logs?



  • Hi,
    I was wondering what is the correct way to rotate the logs of zpush? or do i need to configure log rotation?

    Thank you


  • Kopano

    Hi @killmasta93 ,

    the z-push packages include a config file for logrotation.



  • I suggest you adjust them to these, these correct the user/group and rights on the log files.
    Shown settings are for a Debian server where kopano runs as user kopano.

    for z-push :
    chmod www-data:adm /var/log/z-push or install -d /var/log/z-push -o www-data -g adm -m 640

    the logrotate file

    /var/log/z-push/*.log {
      create 640 www-data adm
      rotate 52
      weekly
      compress
      missingok
      notifempty
    }
    

    /etc/logrotate.d/kopano

    /var/log/kopano/archiver.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
                if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-archiver; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-archiver
                elif [ -f /var/run/kopano/archiver.pid ]; then
                     kill -HUP `cat /var/run/kopano/archiver.pid` 2> /dev/null || true
                fi
            endscript
            compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/dagent.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-dagent; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-dagent
                elif [ -f /var/run/kopano/dagent.pid ]; then
                     kill -HUP `cat /var/run/kopano/dagent.pid` 2> /dev/null || true
                fi
    	endscript
            compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/gateway.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-gateway; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-gateway
                elif [ -f /var/run/kopano/gateway.pid ]; then
                     kill -HUP `cat /var/run/kopano/gateway.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/ical.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-ical; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-ical
                elif [ -f /var/run/kopano/ical.pid ]; then
                     kill -HUP `cat /var/run/kopano/ical.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/search.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-search; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-search
                elif [ -f /var/run/kopano/search.pid ]; then
                     kill -HUP `cat /var/run/kopano/search.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/backup.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-backup; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-backup
                elif [ -f /var/run/kopano/backup.pid ]; then
                     kill -HUP `cat /var/run/kopano/backup.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/presence.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-presence; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-presence
                elif [ -f /var/run/kopano/presence.pid ]; then
                     kill -HUP `cat /var/run/kopano/presence.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/monitor.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-monitor; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-monitor
                elif [ -f /var/run/kopano/monitor.pid ]; then
                     kill -HUP `cat /var/run/kopano/monitor.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/server.log /var/log/kopano/audit.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-server; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-server
                elif [ -f /var/run/kopano/server.pid ]; then
                     kill -HUP `cat /var/run/kopano/server.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/spooler.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-spooler; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-spooler
                elif [ -f /var/run/kopano/spooler.pid ]; then
                     kill -HUP `cat /var/run/kopano/spooler.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    
    /var/log/kopano/spamd.log {
            weekly
            missingok
    	create 640 kopano adm
            rotate 52
    	postrotate
    	    if [ -d /run/systemd/system ] && command systemctl >/dev/null 2>&1 && systemctl is-active --quiet kopano-spamd; then
                    systemctl kill --kill-who all --signal=SIGHUP kopano-spamd
                elif [ -f /var/run/kopano/spamd.pid ]; then
                     kill -HUP `cat /var/run/kopano/spamd.pid` 2> /dev/null || true
                fi
            endscript
    	compress
            delaycompress
            notifempty
    }
    

    Greetz,

    Louis



  • @thctlo wow thanks for the reply thats what i needed

    @fbartels thanks for the reply, i think i installed zpush manually im still using ubuntu 14 hopefully soon to move to 16


  • Kopano

    @thctlo said in zpush rotate logs?:

    I suggest you adjust them to these

    In case this was directed at me I suggest you to open a pull request with your changes. You can find contribution directions for z-push at https://wiki.z-hub.io/display/ZP/Development+guidelines the z-push logrotate file is located at https://stash.z-hub.io/projects/ZP/repos/z-push/browse/config/z-push.lr (for Rhel there are two more variants).

    For Kopano itself it’s the easiest to just open a pr on GitHub. The default logrotate file is stored at https://github.com/Kopano-dev/kopano-core/blob/master/installer/linux/kopano.logrotate.



  • Hai Felix,

    No problem, i’ll do a git clone and send a merge request, but the above is setup of Debian and related.
    For example, this : create 640 kopano adm
    Debian policy uses group adm so a system admin can read the logs without sudo.
    This is probley different on RH or others.

    Just ignore that and make a merge request?


  • Kopano

    @thctlo yes, for z-push this is safe to ignore (as the file is anyways only used for debian based distros). For Kopani itself I am not sure at the moment. But having your pr in would certainly serve as a good starting point for further discussion.



  • Kopano logrotate pr at github done.
    About z-push, no github read-only’s ?


  • Kopano

    @thctlo said in zpush rotate logs?:

    About z-push, no github read-only’s ?

    There is a mirror on Github for z-push, but here you really have to follow the steps from the page I linked to earlier.


Log in to reply