[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 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...


Reply to: