Logrotate for Sentora (Centos 6&7 Ubuntu & Debian)
11-29-2015, 09:37 PM
(This post was last modified: 02-24-2016, 09:22 PM by bbspike.
Edit Reason: Updated rules & added Ubuntu/Debain
)
Hello,
Here some code to rotate all the logs for domains and Sentora programs.
Make 3 files in thee logrotate.d directory:
Paste:
Paste:
Paste:
You can finetune the settings if you want. For instance if you don't want always 5 copy's of history you can set this to any value with rotate ...
For Ubuntu or Debian replace the postrotate rules:
Apache - postrotate /etc/init.d/apache2 reload > /dev/null
Proftpd - postrotate /etc/init.d/proftpd force-reload > /dev/null
Dovcecot - Stays the same
For Centos 6.x replace the postrotate rules with:
Apache - postrotate service httpd reload > /dev/null
Proftpd - postrotate service proftpd reload > /dev/null
Dovecot - Stays the same
Here some code to rotate all the logs for domains and Sentora programs.
Make 3 files in thee logrotate.d directory:
Code:
vi /etc/logrotate.d/Sentora-apache
Paste:
Code:
/var/sentora/logs/domains/*/*access.log /var/sentora/logs/domains/*/*bandwidth.log /var/sentora/logs/domains/*/*error.log /var/sentora/logs/zpanel.log /var/sentora/logs/sentora*.log /var/sentora/logs/daemon*.log {
weekly
missingok
rotate 2
compress
delaycompress
create 640 apache apache
sharedscripts
postrotate
systemctl reload httpd > /dev/null
endscript
}
Code:
vi /etc/logrotate.d/Sentora-dovecot
Paste:
Code:
/var/log/dovecot*.log {
weekly
missingok
rotate 5
compress
delaycompress
notifempty
create 666 vmail mail
sharedscripts
postrotate
doveadm log reopen
endscript
}
Code:
vi /etc/logrotate.d/Sentora-proftpd
Paste:
Code:
/var/sentora/logs/proftpd/access.log /var/sentora/logs/proftpd/auth.log /var/sentora/logs/proftpd/xferlog.www {
weekly
missingok
rotate 5
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
# reload could be not sufficient for all logs, a restart is saf$
systemctl reload proftpd >/dev/null
endscript
}
You can finetune the settings if you want. For instance if you don't want always 5 copy's of history you can set this to any value with rotate ...
For Ubuntu or Debian replace the postrotate rules:
Apache - postrotate /etc/init.d/apache2 reload > /dev/null
Proftpd - postrotate /etc/init.d/proftpd force-reload > /dev/null
Dovcecot - Stays the same
For Centos 6.x replace the postrotate rules with:
Apache - postrotate service httpd reload > /dev/null
Proftpd - postrotate service proftpd reload > /dev/null
Dovecot - Stays the same