[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Duda con logrotate, rsyslog remoto deja de loguear al rotar



El 2013-05-07 13:04, C. L. Martinez escribió:
2013/5/7  <maykel@maykel.sytes.net>:
El 2013-05-07 12:08, C. L. Martinez escribió:

On Tue, May 7, 2013 at 9:38 AM,  <maykel@maykel.sytes.net> wrote:

El 2013-05-07 11:19, C. L. Martinez escribió:

2013/5/7  <maykel@maykel.sytes.net>:


Hola muy buenas, tengo un servidor remoto rsyslog, el tema es que
cuando
rota en una config que le he configurado en
/etc/logrotate.d/apache-rsyslog,
deja de rotar en access.log(que son apaches que escriben es este log
remoto).

/var/log/remote/*.log
{
        rotate 7
        daily
        missingok
        noifempty
        delaycompress
        compress
        postrotate
                reload rsyslog >/dev/null 2>&1 || true
        endscript
}

La idea, es que rote los *.log de ése directorio, pero al rotar, deja
el
access.log, en error.log y en ssl-access.log vacío y deja de loguear...



Prueba esto:

/var/log/remote/*.log
{
    sharedscripts
    postrotate
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2>
/dev/null || true
    endscript
}



Me reporta esto al lanzarlo con logrotate -d -f apache2-rsyslog

reading config file /etc/logrotate.d/apache2-rsyslog
reading config info for /var/log/remote/*.log


Handling 1 logs

rotating pattern: /var/log/remote/*.log
 forced from command line (no old logs will be kept)
empty log files are rotated, old logs are removed
considering log /var/log/remote/access.log
  log needs rotating
considering log /var/log/remote/error.log
  log needs rotating
considering log /var/log/remote/ssl_access.log
  log needs rotating
rotating log /var/log/remote/access.log, log->rotateCount is 0
dateext suffix '-20130507'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/remote/access.log.1 to /var/log/remote/access.log.2
(rotatecount 1, logstart 1, i 1),
renaming /var/log/remote/access.log.0 to /var/log/remote/access.log.1
(rotatecount 1, logstart 1, i 0),
rotating log /var/log/remote/error.log, log->rotateCount is 0
dateext suffix '-20130507'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/remote/error.log.1 to /var/log/remote/error.log.2
(rotatecount 1, logstart 1, i 1),
renaming /var/log/remote/error.log.0 to /var/log/remote/error.log.1
(rotatecount 1, logstart 1, i 0),
rotating log /var/log/remote/ssl_access.log, log->rotateCount is 0
dateext suffix '-20130507'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/remote/ssl_access.log.1 to
/var/log/remote/ssl_access.log.2 (rotatecount 1, logstart 1, i 1),
renaming /var/log/remote/ssl_access.log.0 to
/var/log/remote/ssl_access.log.1 (rotatecount 1, logstart 1, i 0),
renaming /var/log/remote/access.log to /var/log/remote/access.log.1
disposeName will be /var/log/remote/access.log.1
renaming /var/log/remote/error.log to /var/log/remote/error.log.1
disposeName will be /var/log/remote/error.log.1
renaming /var/log/remote/ssl_access.log to
/var/log/remote/ssl_access.log.1
disposeName will be /var/log/remote/ssl_access.log.1
running postrotate script
running script (multiple) with arg /var/log/remote/*.log
: "

        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2>
/dev/null || true
"
removing old log /var/log/remote/access.log.1
removing old log /var/log/remote/error.log.1
removing old log /var/log/remote/ssl_access.log.1



Es correcta la salida, ahora solo le tienes que decir cuantos dias o
logs quieres guardar, los permisos y listo ...


Gracias por contestar. Lo he dejado así:

/var/log/remote/*.log
{
    rotate 7
    create 0660 root admin

    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2>
/dev/null || true
    endscript
}


Pero claro, al lanzarlo no encuentra los ficheros:

reading config file apache2-rsyslog

reading config info for /var/log/remote/*.log


Handling 1 logs

rotating pattern: /var/log/remote/*.log
 forced from command line (7 rotations)

empty log files are rotated, old logs are removed
considering log /var/log/remote/access.log
  log needs rotating
considering log /var/log/remote/error.log
  log needs rotating
considering log /var/log/remote/ssl_access.log
  log needs rotating
rotating log /var/log/remote/access.log, log->rotateCount is 7
dateext suffix '-20130507'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/remote/access.log.7 to /var/log/remote/access.log.8
(rotatecount 7, logstart 1, i 7),
renaming /var/log/remote/access.log.6 to /var/log/remote/access.log.7
(rotatecount 7, logstart 1, i 6),
renaming /var/log/remote/access.log.5 to /var/log/remote/access.log.6
(rotatecount 7, logstart 1, i 5),
renaming /var/log/remote/access.log.4 to /var/log/remote/access.log.5
(rotatecount 7, logstart 1, i 4),
renaming /var/log/remote/access.log.3 to /var/log/remote/access.log.4
(rotatecount 7, logstart 1, i 3),
renaming /var/log/remote/access.log.2 to /var/log/remote/access.log.3
(rotatecount 7, logstart 1, i 2),
renaming /var/log/remote/access.log.1 to /var/log/remote/access.log.2
(rotatecount 7, logstart 1, i 1),
renaming /var/log/remote/access.log.0 to /var/log/remote/access.log.1
(rotatecount 7, logstart 1, i 0),
rotating log /var/log/remote/error.log, log->rotateCount is 7

dateext suffix '-20130507'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/remote/error.log.7 to /var/log/remote/error.log.8
(rotatecount 7, logstart 1, i 7),
renaming /var/log/remote/error.log.6 to /var/log/remote/error.log.7
(rotatecount 7, logstart 1, i 6),
renaming /var/log/remote/error.log.5 to /var/log/remote/error.log.6
(rotatecount 7, logstart 1, i 5),
renaming /var/log/remote/error.log.4 to /var/log/remote/error.log.5
(rotatecount 7, logstart 1, i 4),
renaming /var/log/remote/error.log.3 to /var/log/remote/error.log.4
(rotatecount 7, logstart 1, i 3),
renaming /var/log/remote/error.log.2 to /var/log/remote/error.log.3
(rotatecount 7, logstart 1, i 2),
renaming /var/log/remote/error.log.1 to /var/log/remote/error.log.2
(rotatecount 7, logstart 1, i 1),
renaming /var/log/remote/error.log.0 to /var/log/remote/error.log.1
(rotatecount 7, logstart 1, i 0),
rotating log /var/log/remote/ssl_access.log, log->rotateCount is 7

dateext suffix '-20130507'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/remote/ssl_access.log.7 to
/var/log/remote/ssl_access.log.8 (rotatecount 7, logstart 1, i 7),
renaming /var/log/remote/ssl_access.log.6 to
/var/log/remote/ssl_access.log.7 (rotatecount 7, logstart 1, i 6),
renaming /var/log/remote/ssl_access.log.5 to
/var/log/remote/ssl_access.log.6 (rotatecount 7, logstart 1, i 5),
renaming /var/log/remote/ssl_access.log.4 to
/var/log/remote/ssl_access.log.5 (rotatecount 7, logstart 1, i 4),
renaming /var/log/remote/ssl_access.log.3 to
/var/log/remote/ssl_access.log.4 (rotatecount 7, logstart 1, i 3),
renaming /var/log/remote/ssl_access.log.2 to
/var/log/remote/ssl_access.log.3 (rotatecount 7, logstart 1, i 2),
renaming /var/log/remote/ssl_access.log.1 to
/var/log/remote/ssl_access.log.2 (rotatecount 7, logstart 1, i 1),
renaming /var/log/remote/ssl_access.log.0 to
/var/log/remote/ssl_access.log.1 (rotatecount 7, logstart 1, i 0),
renaming /var/log/remote/access.log to /var/log/remote/access.log.1
creating new /var/log/remote/access.log mode = 0660 uid = 0 gid = 111
renaming /var/log/remote/error.log to /var/log/remote/error.log.1
creating new /var/log/remote/error.log mode = 0660 uid = 0 gid = 111
renaming /var/log/remote/ssl_access.log to /var/log/remote/ssl_access.log.1 creating new /var/log/remote/ssl_access.log mode = 0660 uid = 0 gid = 111

running postrotate script
running script (multiple) with arg /var/log/remote/*.log
: "
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2>
/dev/null || true
"
removing old log /var/log/remote/access.log.8
error: error opening /var/log/remote/access.log.8: No existe el fichero o el
directorio

Pero no lo entiendo, porque en teoría tiene que ir rotándolos hasta que llegue al access.log.8 y vaya rotando y borrando para los nuevos logs...




No hay ningun error en lo que envias ... Tu le estás diciendo que
guarde solo 7 archivos de log, no 8 ... Lo que no acabo de ver es
porque no te ha borrado los .7, debería guardarte del .0 al .6 ...


Será porque todavía no los ha creado y no existen...

-rw-r----- 1 syslog adm  283082 2013-05-07 13:05 access.log
-rw-r----- 1 syslog adm 2689982 2013-05-05 06:25 access.log.1
-rw-r----- 1 syslog adm  350734 2013-04-28 06:49 access.log.2.gz
-rw-r----- 1 syslog adm  122927 2013-04-21 06:43 access.log.3.gz
-rw-r----- 1 syslog adm   18651 2013-05-07 12:59 error.log
-rw-r----- 1 syslog adm  374029 2013-05-05 06:04 error.log.1
-rw-r----- 1 syslog adm   29684 2013-04-28 06:37 error.log.2.gz
-rw-r----- 1 syslog adm   36009 2013-04-21 05:34 error.log.3.gz
-rw-r----- 1 syslog adm   29830 2013-05-07 11:16 ssl_access.log
-rw-r----- 1 syslog adm   58882 2013-05-03 10:25 ssl_access.log.1
-rw-r----- 1 syslog adm    8136 2013-04-26 13:25 ssl_access.log.2.gz
-rw-r----- 1 syslog adm   12268 2013-04-18 18:02 ssl_access.log.3.gz


Reply to: