Retour : Page Principale > sommaire aide > sommaire aide-mémos
logrotate -d /etc/logrotate.conf
Php-fpm : exemple pour la version 5.5
Sphinx
Nginx : log des erreurs et accès globaux (tous sites confondus)
Nginx sites : log des erreurs et accès aux différents sites
Utilisation et configuration de Logrotate
Tester la configuration sans faire de modification
La commande suivante affiche le comportement de logrotate mais ne fait aucun changement sur le disque. Utile pour tester.logrotate -d /etc/logrotate.conf
Exemple de fichiers de configuration de logrotate (présents dans /etc/logrotate.d/)
Mysql : exemple pour la version 5.5
/home/mysql/5.5/log/mysqld.log /home/mysql/5.5/log/mysql-slow.log {
# create 600 mysql mysql
notifempty
monthly
rotate 3
missingok
compress
postrotate
# just if mysqld is really running
if test -x /usr/local/mysql/5.5/bin/mysqladmin && \
/usr/local/mysql/5.5/bin/mysqladmin ping &>/dev/null
then
/usr/local/mysql/5.5/bin/mysqladmin flush-logs
fi
endscript
}
Php-fpm : exemple pour la version 5.5
/home/log/php-55-fpm.log {
daily
compress
delaycompress
rotate 10
missingok
notifempty
create 644 root adm
sharedscripts
postrotate
/bin/kill -SIGUSR1 `cat /usr/local/php/5.5/var/run/php-fpm.pid 2>/dev/null` 2>/dev/null || true
endscript
}
Sphinx
/home/log/sphinx/sphinx-searchd.log /home/log/sphinx/sphinx-query.log {
weekly
rotate 5
compress
delaycompress
create 640 root adm
postrotate
start-stop-daemon -K -p /var/run/sphinx/sphinx-searchd.pid -s USR1 -x /home/sphinx/bin/searchd -q
endscript
}
Nginx : log des erreurs et accès globaux (tous sites confondus)
/home/log/nginx-*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
Nginx sites : log des erreurs et accès aux différents sites
/home/apitela/_logs/*.log {
daily
missingok
rotate 10
size 10M
compress
delaycompress
notifempty
create 660 www-data apitela
sharedscripts
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
/home/apitest/_logs/*.log {
daily
missingok
rotate 10
size 10M
compress
delaycompress
notifempty
create 660 www-data apitest
sharedscripts
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
/home/admin/_logs/*.log {
daily
missingok
rotate 10
size 10M
compress
delaycompress
notifempty
create 660 www-data admin
sharedscripts
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}