
Estoy intentando configurar logrotate. Estoy obteniendo resultados inesperados; Algunos archivos de registro tienen varias fechas y/o un tamaño de cero bytes. Me gustaría tener un registro para cada día y tener la fecha en el nombre del archivo del registro anterior, manteniendo solo los registros de los últimos 30 días.
aquí está mi entrada de logrotate
/var/www/html/joomla-1.x/example.com/logs/*.log {
missingok
daily
dateext
extension .log
rotate 30
notifempty
sharedscripts
nocompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
Los siguientes son los archivos de registro que se han rotado.
[root@Webserver-2 logs]# ls -la
total 72460
drwxrwxr-x. 2 apache apache 28672 Jan 13 03:08 .
drwxrwxr-x. 4 apache apache 4096 Nov 21 12:51 ..
-rw-r--r--. 1 root root 20367769 Jan 8 03:42 access-20140108-20140110-20140112.log
-rw-r--r--. 1 root root 0 Jan 12 03:08 access-20140108-20140110.log
-rw-r--r--. 1 root root 0 Jan 10 03:38 access-20140108.log
-rw-r--r--. 1 root root 9925777 Jan 9 03:21 access-20140109-20140111-20140113.log
-rw-r--r--. 1 root root 0 Jan 13 03:08 access-20140109-20140111.log
-rw-r--r--. 1 root root 0 Jan 11 03:26 access-20140109.log
-rw-r--r--. 1 root root 9961813 Jan 10 03:37 access-20140110-20140112.log
-rw-r--r--. 1 root root 0 Jan 12 03:08 access-20140110.log
-rw-r--r--. 1 root root 10114757 Jan 11 03:25 access-20140111-20140113.log
-rw-r--r--. 1 root root 0 Jan 13 03:08 access-20140111.log
-rw-r--r--. 1 root root 10640709 Jan 12 03:08 access-20140112.log
-rw-r--r--. 1 root root 10069927 Jan 13 03:07 access-20140113.log
-rw-r--r--. 1 root root 908253 Jan 13 08:59 access.log
-rw-r--r--. 1 root root 622524 Jan 8 03:39 error-20140108-20140110-20140112.log
-rw-r--r--. 1 root root 0 Jan 12 03:08 error-20140108-20140110.log
-rw-r--r--. 1 root root 0 Jan 10 03:38 error-20140108.log
-rw-r--r--. 1 root root 258401 Jan 9 03:18 error-20140109-20140111-20140113.log
-rw-r--r--. 1 root root 0 Jan 13 03:08 error-20140109-20140111.log
-rw-r--r--. 1 root root 0 Jan 11 03:26 error-20140109.log
-rw-r--r--. 1 root root 291228 Jan 10 03:37 error-20140110-20140112.log
-rw-r--r--. 1 root root 0 Jan 12 03:08 error-20140110.log
-rw-r--r--. 1 root root 305361 Jan 11 03:22 error-20140111-20140113.log
-rw-r--r--. 1 root root 0 Jan 13 03:08 error-20140111.log
-rw-r--r--. 1 root root 292764 Jan 12 03:04 error-20140112.log
-rw-r--r--. 1 root root 283243 Jan 13 02:59 error-20140113.log
-rw-r--r--. 1 root root 30299 Jan 13 08:58 error.log
-rw-r--r--. 1 apache apache 919 Dec 23 08:11 error.php
[root@Webserver-2 logs]#
Respuesta1
El problema con su configuración es que también rota los archivos de registro que ya han sido rotados configurando extension .log
y usando el /var/www/html/joomla-1.x/example.com/logs/*.log
comodín.
Repita la estrofa mientras nombra explícitamente /var/www/html/joomla-1.x/example.com/logs/access.log
o /var/www/html/joomla-1.x/example.com/logs/error.log
elimine la extension .log
opción.