Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).

#1 18-02-2014 11:07:57

sechanbask
Membre
Inscription : 14-10-2009

[Résolu] logrotate ne rotate plus...

Bonjour,

J'ai dû mettre très rapidement une machine virtuelle en production dans ma petite entreprise (6 personnes) en sachant que ma machine virtuelle avait un problème de log. Comme tout marche à merveille (merci debian) j'ai pas envie de réinstaller ce système juste pour un problème de log, je préfère trouver la solution.

J'ai créer la machine le 26 juin, elle a tourné pour faire des sauvegardes, mais depuis le début novembre, les log ne tournent pas et les anciens ne s'effacent pas :


cat /var/log/syslog :

Nov  8 03:10:01 local /USR/SBIN/CRON[7729]: (root) CMD (sh /root/script/bet.sh > /dev/null 2>&1)
[...]
Feb 18 08:23:01 local /USR/SBIN/CRON[10601]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)



j'ai tenté un :

/usr/sbin/logrotate -vf /etc/logrotate.conf

including /etc/logrotate.d
reading config file apt
reading config file aptitude
reading config file dpkg
reading config file rsyslog
reading config file samba
reading config file winbind

Handling 12 logs

rotating pattern: /var/log/apt/term.log  forced from command line (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apt/term.log
  log does not need rotating

rotating pattern: /var/log/apt/history.log  forced from command line (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apt/history.log
  log does not need rotating

rotating pattern: /var/log/aptitude  forced from command line (6 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/aptitude
  log does not need rotating

rotating pattern: /var/log/dpkg.log  forced from command line (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/dpkg.log
  log does not need rotating

rotating pattern: /var/log/alternatives.log  forced from command line (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/alternatives.log
  log does not need rotating

rotating pattern: /var/log/syslog
 forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/syslog
  log needs rotating
rotating log /var/log/syslog, log->rotateCount is 7
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
log /var/log/syslog.8.gz doesn't exist -- won't try to dispose of it

rotating pattern: /var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
 forced from command line (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/mail.info
  log needs rotating
considering log /var/log/mail.warn
  log needs rotating
considering log /var/log/mail.err
  log needs rotating
considering log /var/log/mail.log
  log needs rotating
considering log /var/log/daemon.log
  log needs rotating
considering log /var/log/kern.log
  log needs rotating
considering log /var/log/auth.log
  log needs rotating
considering log /var/log/user.log
  log needs rotating
considering log /var/log/lpr.log
  log does not need rotating
considering log /var/log/cron.log
  log /var/log/cron.log does not exist -- skipping
considering log /var/log/debug
  log does not need rotating
considering log /var/log/messages
  log needs rotating
rotating log /var/log/mail.info, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.info.1 does not exist
renaming /var/log/mail.info.4.gz to /var/log/mail.info.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.info.4.gz does not exist
renaming /var/log/mail.info.3.gz to /var/log/mail.info.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/mail.info.3.gz does not exist
renaming /var/log/mail.info.2.gz to /var/log/mail.info.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/mail.info.2.gz does not exist
renaming /var/log/mail.info.1.gz to /var/log/mail.info.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/mail.info.1.gz does not exist
renaming /var/log/mail.info.0.gz to /var/log/mail.info.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/mail.info.0.gz does not exist
rotating log /var/log/mail.warn, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.warn.1 does not exist
renaming /var/log/mail.warn.4.gz to /var/log/mail.warn.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.warn.4.gz does not exist
renaming /var/log/mail.warn.3.gz to /var/log/mail.warn.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/mail.warn.3.gz does not exist
renaming /var/log/mail.warn.2.gz to /var/log/mail.warn.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/mail.warn.2.gz does not exist
renaming /var/log/mail.warn.1.gz to /var/log/mail.warn.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/mail.warn.1.gz does not exist
renaming /var/log/mail.warn.0.gz to /var/log/mail.warn.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/mail.warn.0.gz does not exist
log /var/log/mail.warn.5.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/mail.err, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.err.1 does not exist
renaming /var/log/mail.err.4.gz to /var/log/mail.err.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.err.4.gz does not exist
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.info.1 does not exist
renaming /var/log/mail.info.4.gz to /var/log/mail.info.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.info.4.gz does not exist
renaming /var/log/mail.info.3.gz to /var/log/mail.info.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/mail.info.3.gz does not exist
renaming /var/log/mail.info.2.gz to /var/log/mail.info.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/mail.info.2.gz does not exist
renaming /var/log/mail.info.1.gz to /var/log/mail.info.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/mail.info.1.gz does not exist
renaming /var/log/mail.info.0.gz to /var/log/mail.info.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/mail.info.0.gz does not exist
rotating log /var/log/mail.warn, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.warn.1 does not exist
renaming /var/log/mail.warn.4.gz to /var/log/mail.warn.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.warn.4.gz does not exist
renaming /var/log/mail.warn.3.gz to /var/log/mail.warn.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/mail.warn.3.gz does not exist
renaming /var/log/mail.warn.2.gz to /var/log/mail.warn.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/mail.warn.2.gz does not exist
renaming /var/log/mail.warn.1.gz to /var/log/mail.warn.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/mail.warn.1.gz does not exist
renaming /var/log/mail.warn.0.gz to /var/log/mail.warn.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/mail.warn.0.gz does not exist
log /var/log/mail.warn.5.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/mail.err, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.err.1 does not exist
renaming /var/log/mail.err.4.gz to /var/log/mail.err.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.err.4.gz does not exist
renaming /var/log/mail.err.3.gz to /var/log/mail.err.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/mail.err.3.gz does not exist
renaming /var/log/mail.err.2.gz to /var/log/mail.err.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/mail.err.2.gz does not exist
renaming /var/log/mail.err.1.gz to /var/log/mail.err.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/mail.err.1.gz does not exist
renaming /var/log/mail.err.0.gz to /var/log/mail.err.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/mail.err.0.gz does not exist
log /var/log/mail.err.5.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/mail.log, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/mail.log.1 does not exist
renaming /var/log/mail.log.4.gz to /var/log/mail.log.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/mail.log.4.gz does not exist
renaming /var/log/mail.log.3.gz to /var/log/mail.log.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/mail.log.3.gz does not exist
renaming /var/log/mail.log.2.gz to /var/log/mail.log.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/mail.log.2.gz does not exist
renaming /var/log/mail.log.1.gz to /var/log/mail.log.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/mail.log.1.gz does not exist
renaming /var/log/mail.log.0.gz to /var/log/mail.log.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/mail.log.0.gz does not exist
rotating log /var/log/daemon.log, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/daemon.log.1 does not exist
renaming /var/log/daemon.log.4.gz to /var/log/daemon.log.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/daemon.log.4.gz does not exist
renaming /var/log/daemon.log.3.gz to /var/log/daemon.log.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/daemon.log.3.gz does not exist
renaming /var/log/daemon.log.2.gz to /var/log/daemon.log.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/daemon.log.2.gz does not exist
rotating log /var/log/kern.log, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/kern.log.1 does not exist
renaming /var/log/kern.log.4.gz to /var/log/kern.log.5.gz (rotatecount 4, logstart 1, i 4),
old log /var/log/kern.log.4.gz does not exist
renaming /var/log/kern.log.3.gz to /var/log/kern.log.4.gz (rotatecount 4, logstart 1, i 3),
old log /var/log/kern.log.3.gz does not exist
renaming /var/log/kern.log.2.gz to /var/log/kern.log.3.gz (rotatecount 4, logstart 1, i 2),
old log /var/log/kern.log.2.gz does not exist
renaming /var/log/kern.log.1.gz to /var/log/kern.log.2.gz (rotatecount 4, logstart 1, i 1),
old log /var/log/kern.log.1.gz does not exist
renaming /var/log/kern.log.0.gz to /var/log/kern.log.1.gz (rotatecount 4, logstart 1, i 0),
old log /var/log/kern.log.0.gz does not exist
rotating log /var/log/auth.log, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
error: error creating output file /var/log/auth.log.1.gz: Le fichier existe
log /var/log/auth.log.5.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/user.log, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
error: error creating output file /var/log/user.log.1.gz: Le fichier existe
log /var/log/user.log.5.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/messages, log->rotateCount is 4
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
error: error creating output file /var/log/messages.1.gz: Le fichier existe
log /var/log/messages.5.gz doesn't exist -- won't try to dispose of it

rotating pattern: /var/log/samba/log.smbd  forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/samba/log.smbd
  log needs rotating
rotating log /var/log/samba/log.smbd, log->rotateCount is 7
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/samba/log.smbd.7.gz to /var/log/samba/log.smbd.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/log/samba/log.smbd.6.gz to /var/log/samba/log.smbd.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/log/samba/log.smbd.5.gz to /var/log/samba/log.smbd.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/log/samba/log.smbd.4.gz to /var/log/samba/log.smbd.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/log/samba/log.smbd.3.gz to /var/log/samba/log.smbd.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/log/samba/log.smbd.2.gz to /var/log/samba/log.smbd.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/log/samba/log.smbd.1.gz to /var/log/samba/log.smbd.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/log/samba/log.smbd.0.gz to /var/log/samba/log.smbd.1.gz (rotatecount 7, logstart 1, i 0),
old log /var/log/samba/log.smbd.0.gz does not exist
renaming /var/log/samba/log.smbd to /var/log/samba/log.smbd.1
creating new /var/log/samba/log.smbd mode = 0644 uid = 0 gid = 0
running postrotate script
compressing log with: /bin/gzip
removing old log /var/log/samba/log.smbd.8.gz

rotating pattern: /var/log/samba/log.nmbd  forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/samba/log.nmbd
  log does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/samba/log.winbindd  forced from command line (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/samba/log.winbindd
  log does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/wtmp  forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/wtmp
  log needs rotating
rotating log /var/log/wtmp, log->rotateCount is 1
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/wtmp.1.gz to /var/log/wtmp.2.gz (rotatecount 1, logstart 1, i 1),
renaming /var/log/wtmp.0.gz to /var/log/wtmp.1.gz (rotatecount 1, logstart 1, i 0),
old log /var/log/wtmp.0.gz does not exist
renaming /var/log/wtmp to /var/log/wtmp.1
creating new /var/log/wtmp mode = 0664 uid = 0 gid = 43
compressing log with: /bin/gzip
removing old log /var/log/wtmp.2.gz

rotating pattern: /var/log/btmp  forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
  log needs rotating
rotating log /var/log/btmp, log->rotateCount is 1
dateext suffix '-20140218'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/btmp.1.gz to /var/log/btmp.2.gz (rotatecount 1, logstart 1, i 1),
renaming /var/log/btmp.0.gz to /var/log/btmp.1.gz (rotatecount 1, logstart 1, i 0),
old log /var/log/btmp.0.gz does not exist
renaming /var/log/btmp to /var/log/btmp.1
creating new /var/log/btmp mode = 0660 uid = 0 gid = 43
compressing log with: /bin/gzip
removing old log /var/log/btmp.2.gz
 




et un fichier est apparut dans mon /root/ dont voici un extrait:

# nano dead.letter


/etc/cron.daily/logrotate:
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
run-parts: /etc/cron.daily/logrotate exited with return code 1


/etc/cron.daily/logrotate:
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
run-parts: /etc/cron.daily/logrotate exited with return code 1


/etc/cron.daily/logrotate:
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
run-parts: /etc/cron.daily/logrotate exited with return code 1


/etc/cron.daily/logrotate:
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
run-parts: /etc/cron.daily/logrotate exited with return code 1


/etc/cron.daily/logrotate:
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
run-parts: /etc/cron.daily/logrotate exited with return code 1


/etc/cron.daily/logrotate:
error: error creating output file /var/log/syslog.1.gz: Le fichier existe
error: error creating output file /var/log/auth.log.1.gz: Le fichier existe
error: error creating output file /var/log/user.log.1.gz: Le fichier existe
error: error creating output file /var/log/messages.1.gz: Le fichier existe
run-parts: /etc/cron.daily/logrotate exited with return code 1

 




J'ai pourtant une configuration classique que j'ai pas modifiée :


nano /etc/logrotate.conf

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here
 





# nano /etc/logrotate.d/rsyslog

/var/log/syslog
{
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
                invoke-rc.d rsyslog rotate > /dev/null
        endscript
}

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
{
        rotate 4
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                invoke-rc.d rsyslog rotate > /dev/null
        endscript
}
 



Merci de m'aider à y voir plus clair...

Dernière modification par sechanbask (18-02-2014 22:49:26)

Hors ligne

#2 18-02-2014 14:06:07

captnfab
Admin-Girafe
Lieu : /dev/random
Distrib. : Debian Stretch/Sid/Rc-Buggy
Noyau : Linux (≥ 4.3)
(G)UI : i3-wm (≥ 4.11)
Inscription : 07-07-2008
Site Web

Re : [Résolu] logrotate ne rotate plus...

Salut,

Mhh, c'est embettant comme histoire.

Ce message [1] t'explique un peu le fonctionnement de logrotate et explique ce que signifie le message d'erreur.
Je ne suis par contre pas certain que la solution soit satisfaisante.

Celui-ci [2] est le deuxième cas que j'ai trouvé sur le net, la raison du problème était un disque dur défaillant.


[1] https://lists.debian.org/debian-user/20 … 01407.html
[2] https://lists.debian.org/debian-user/20 … 00172.html

As-tu déjà essayé de supprimer tous tes logs anciens ? (vu qu'ils ont des mois maintenant…)
Genre virer tous les .gz

As-tu vérifié l'état de ton disque-dur récemment ? (avec les smartmontools par exemple)

captnfab,
Association Debian-Facile, bépo.
TheDoctor: Your wish is my command… But be careful what you wish for.

Hors ligne

#3 18-02-2014 15:25:43

sechanbask
Membre
Inscription : 14-10-2009

Re : [Résolu] logrotate ne rotate plus...

Merci pour ses infos, j'ai supprimé les gz qui bloquaient la conpression des plus récents.

Mise à part avec

/usr/sbin/logrotate -vf /etc/logrotate.conf



Comment puis-je voir si toutes les rotations se déroulent bien ?

Puisque ma machine est viruelle (sous hyperviseur PROXMOX) sur un fs EXT4 dans un LVM sur RAID 5 matériel.
Dois-je vérifier le fs ext4 ? ou faire un smart sur le raid ?

Hors ligne

#4 18-02-2014 15:51:18

captnfab
Admin-Girafe
Lieu : /dev/random
Distrib. : Debian Stretch/Sid/Rc-Buggy
Noyau : Linux (≥ 4.3)
(G)UI : i3-wm (≥ 4.11)
Inscription : 07-07-2008
Site Web

Re : [Résolu] logrotate ne rotate plus...

Normalement root reçois un mail en cas de problème.
Il te suffit de rediriger les mails root de la VM sur un compte à toi.

Pour les disques, si c'est du raid5, y'a quand même peu de chances pour que tes disques soient tous HS, mais ce serait sur les disques qu'il faudrait faire la vérif, pas sur le système de fichier.

captnfab,
Association Debian-Facile, bépo.
TheDoctor: Your wish is my command… But be careful what you wish for.

Hors ligne

#5 18-02-2014 22:48:37

sechanbask
Membre
Inscription : 14-10-2009

Re : [Résolu] logrotate ne rotate plus...

rapide et efficace merci pour tout !

Hors ligne

Pied de page des forums