Logrotate ne se lance pas

Bonjour,

voici mon problème résumé dans le titre : logrotate ne se lance pas.

Je suis en sid à jour (18-11-13), et j’ai remarqué il y a quelques jours que les fichiers
/var/log/syslog et /var/log/messages notamment faisaient 200Mo et qu’ils
n’avaient jamais subi de rotation depuis l’installation du poste (fev 2013)

j’ai logrotate d’installé, avec la config par défaut (pour syslog par exemple c’est tous les jours normalement)

si je le lance à la main
([mono]#logrotate -f /etc/logrotate.conf[/mono]) ,
ça fonctionne, mais sinon il ne se lance pas tout seul

j’ai vérifié que le fichier [mono]/etc/cron.daily/logrotate[/mono] était présent, toujours dans la configuration par défaut.
crontab me dit que la les fichiers cron.daily doivent etre lancés à 6h25 tous les jours
Comme c’est mon poste de chez moi, il n’est pas allumé en permanence et rarement à 6h25…

d’où mes questions

  • est-ce que logrotate est lancé automatiquement au démarrage du système?
  • est-ce normal que sur ce poste il ne soit jamais lancé automatiquement?

en bonus, voici une copie du résultat de

[code]# logrotate -d /etc/logrotate.conf
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apt
reading config file aptitude
reading config file consolekit
reading config file cups-daemon
reading config file dpkg
reading config file exim4-base
reading config file exim4-paniclog
reading config file pm-utils
reading config file rsyslog

Handling 14 logs

rotating pattern: /var/log/apt/term.log monthly (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 monthly (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 monthly (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/ConsoleKit/history monthly (6 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/ConsoleKit/history
log does not need rotating

rotating pattern: /var/log/cups/*log after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/cups/access_log
log does not need rotating
considering log /var/log/cups/cups-pdf_log
log does not need rotating
considering log /var/log/cups/error_log
log needs rotating
considering log /var/log/cups/page_log
log does not need rotating
rotating log /var/log/cups/error_log, log->rotateCount is 7
dateext suffix '-20131118’
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/cups/error_log.7.gz to /var/log/cups/error_log.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/log/cups/error_log.6.gz to /var/log/cups/error_log.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/log/cups/error_log.5.gz to /var/log/cups/error_log.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/log/cups/error_log.4.gz to /var/log/cups/error_log.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/log/cups/error_log.3.gz to /var/log/cups/error_log.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/log/cups/error_log.2.gz to /var/log/cups/error_log.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/log/cups/error_log.1.gz to /var/log/cups/error_log.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/log/cups/error_log.0.gz to /var/log/cups/error_log.1.gz (rotatecount 7, logstart 1, i 0),
running prerotate script
running script with arg /var/log/cups/*log : "
if [ -e /var/run/cups/cupsd.pid ]; then
invoke-rc.d --quiet cups stop > /dev/null
touch /var/run/cups/cupsd.stopped
fi
"
renaming /var/log/cups/error_log to /var/log/cups/error_log.1
creating new /var/log/cups/error_log mode = 0640 uid = 0 gid = 110
running postrotate script
running script with arg /var/log/cups/*log : "
if [ -e /var/run/cups/cupsd.stopped ]; then
rm /var/run/cups/cupsd.stopped
invoke-rc.d --quiet cups start > /dev/null
sleep 10
fi
"
compressing log with: /bin/gzip
removing old log /var/log/cups/error_log.8.gz
error: error opening /var/log/cups/error_log.8.gz: Aucun fichier ou dossier de ce type

rotating pattern: /var/log/dpkg.log monthly (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 monthly (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/exim4/mainlog /var/log/exim4/rejectlog after 1 days (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/exim4/mainlog
log needs rotating
considering log /var/log/exim4/rejectlog
log /var/log/exim4/rejectlog does not exist – skipping
rotating log /var/log/exim4/mainlog, log->rotateCount is 10
dateext suffix '-20131118’
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/exim4/mainlog.10.gz to /var/log/exim4/mainlog.11.gz (rotatecount 10, logstart 1, i 10),
renaming /var/log/exim4/mainlog.9.gz to /var/log/exim4/mainlog.10.gz (rotatecount 10, logstart 1, i 9),
renaming /var/log/exim4/mainlog.8.gz to /var/log/exim4/mainlog.9.gz (rotatecount 10, logstart 1, i 8),
renaming /var/log/exim4/mainlog.7.gz to /var/log/exim4/mainlog.8.gz (rotatecount 10, logstart 1, i 7),
renaming /var/log/exim4/mainlog.6.gz to /var/log/exim4/mainlog.7.gz (rotatecount 10, logstart 1, i 6),
renaming /var/log/exim4/mainlog.5.gz to /var/log/exim4/mainlog.6.gz (rotatecount 10, logstart 1, i 5),
renaming /var/log/exim4/mainlog.4.gz to /var/log/exim4/mainlog.5.gz (rotatecount 10, logstart 1, i 4),
renaming /var/log/exim4/mainlog.3.gz to /var/log/exim4/mainlog.4.gz (rotatecount 10, logstart 1, i 3),
renaming /var/log/exim4/mainlog.2.gz to /var/log/exim4/mainlog.3.gz (rotatecount 10, logstart 1, i 2),
renaming /var/log/exim4/mainlog.1.gz to /var/log/exim4/mainlog.2.gz (rotatecount 10, logstart 1, i 1),
renaming /var/log/exim4/mainlog.0.gz to /var/log/exim4/mainlog.1.gz (rotatecount 10, logstart 1, i 0),
renaming /var/log/exim4/mainlog to /var/log/exim4/mainlog.1
creating new /var/log/exim4/mainlog mode = 0640 uid = 101 gid = 4
removing old log /var/log/exim4/mainlog.11.gz
error: error opening /var/log/exim4/mainlog.11.gz: Aucun fichier ou dossier de ce type

rotating pattern: /var/log/exim4/paniclog 10485760 bytes (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/exim4/paniclog
log /var/log/exim4/paniclog does not exist – skipping

rotating pattern: /var/log/pm-suspend.log /var/log/pm-powersave.log monthly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/pm-suspend.log
log /var/log/pm-suspend.log does not exist – skipping
considering log /var/log/pm-powersave.log
log does not need rotating

rotating pattern: /var/log/syslog
after 1 days (7 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/syslog
log needs rotating
rotating log /var/log/syslog, log->rotateCount is 7
dateext suffix '-20131118’
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/syslog.7.gz to /var/log/syslog.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/log/syslog.6.gz to /var/log/syslog.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/log/syslog.5.gz to /var/log/syslog.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/log/syslog.4.gz to /var/log/syslog.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/log/syslog.3.gz to /var/log/syslog.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/log/syslog.2.gz to /var/log/syslog.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/log/syslog.1.gz to /var/log/syslog.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/log/syslog.0.gz to /var/log/syslog.1.gz (rotatecount 7, logstart 1, i 0),
renaming /var/log/syslog to /var/log/syslog.1
creating new /var/log/syslog mode = 0644 uid = 0 gid = 4
running postrotate script
running script with arg /var/log/syslog: "
invoke-rc.d rsyslog rotate > /dev/null
"
removing old log /var/log/syslog.8.gz
error: error opening /var/log/syslog.8.gz: Aucun fichier ou dossier de ce type

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
weekly (4 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/mail.info
log does not need rotating
considering log /var/log/mail.warn
log does not need rotating
considering log /var/log/mail.err
log does not need rotating
considering log /var/log/mail.log
log does not need rotating
considering log /var/log/daemon.log
log does not need rotating
considering log /var/log/kern.log
log does not need rotating
considering log /var/log/auth.log
log does not need rotating
considering log /var/log/user.log
log does not need 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 does not need rotating
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/wtmp
log does not need rotating

rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
log does not need rotating
[/code]

où on voit par exemple qu’il y a pas mal de log qui “needs rotating”.

Je passe surement à coté d’un truc, mais quoi?

Vu que ton poste n’est pas allumé en permanence installe le paquet anacron, il sert justement à lancer les cron qui auraient du être exécutés depuis ton dernier shutdown.

ah, bonne idée!
je ne sais pas comment j’ai fait mais j’étais pas tombé dessus lors de mes recherches.
il n’est effectivement pas installé, mais c’est chose faite.

Salut,

[quote=“yabon”]j’ai remarqué il y a quelques jours que les fichiers
/var/log/syslog et /var/log/messages notamment faisaient 200Mo et qu’ils
n’avaient jamais subi de rotation depuis l’installation du poste (fev 2013)[/quote]

C’est en /etc/logrotate.d/service que tu pourras influer sur la rotation de ces derniers. :wink:

[19:15:37] ~ # ll /etc/logrotate.d total 88K -rw-r--r-- 1 root root 395 2013-09-03 14:50 openvas-scanner -rw-r--r-- 1 root root 385 2013-09-03 14:17 openvas-manager -rw-r--r-- 1 root root 365 2013-08-29 14:56 greenbone-security-assistant -rw-r--r-- 1 root root 385 2013-08-29 14:53 openvas-administrator -rw-r--r-- 1 root root 515 2013-03-05 23:32 rsyslog -rw-r--r-- 1 root root 326 2013-03-04 22:33 apache2 -rw-r--r-- 1 root root 100 2013-01-21 21:20 kdm -rw-r--r-- 1 root root 230 2013-01-04 09:12 clamav-freshclam -rw-r--r-- 1 root root 338 2012-12-24 18:47 fail2ban -rw-r--r-- 1 root root 190 2012-11-20 22:49 tor -rw-r--r-- 1 root root 880 2012-10-29 00:24 mysql-server -rw-r--r-- 1 root root 248 2012-06-03 21:26 polipo -rw-r--r-- 1 root root 179 2012-05-30 00:15 preload -rw-r--r-- 1 root root 248 2011-11-28 17:12 cups -rw-r--r-- 1 root root 232 2011-01-30 21:57 dpkg -rw-r--r-- 1 root root 173 2011-01-25 11:57 apt -rw-r--r-- 1 root root 157 2010-11-17 05:09 pm-utils -rw-r--r-- 1 root root 79 2010-10-19 00:25 aptitude -rw-r--r-- 1 root root 222 2010-09-17 12:16 squid -rw-r--r-- 1 root root 113 2010-08-22 10:48 cron-apt -rw-r--r-- 1 root root 94 2010-08-09 02:46 ppp -rw-r--r-- 1 root root 135 2010-02-25 00:06 consolekit [19:15:40] ~ #

oui oui j’avais vu, c’est même dans /etc/logrotate.d/rsyslog que ça se passe,
d’ailleurs logrotate fonctionne bien si on le lance à la main.

Là j’ai installé anacron et j’attends demain pour voir si il va faire son boulot.

Pour tous les serveurs/services. :wink:

Bizarre …

[quote][20:36:48]:~$ aptitude show anacron
Paquet : anacron
État: installé
Automatiquement installé: oui
Version : 2.3-19
Priorité : optionnel
Section : admin

[/quote]

Chez moi :

$ aptitude show anacron 
Paquet : anacron                              
État: installé
Automatiquement installé: non

Donne plutôt le aptitude why :wink:

[quote=“lroy”]
Donne plutôt le aptitude why :wink:[/quote]

Héhé … 8)

[21:46:59] ~ # aptitude why anacron i clamav-freshclam Dépend logrotate i A logrotate Dépend cron | anacron | cron-daemon [21:47:18] ~ #

[21:51:46] ~ # apt-rdepends anacron Reading package lists... Done Building dependency tree Reading state information... Done anacron Depends: debianutils (>= 1.7) Depends: libc6 (>= 2.7) Depends: lsb-base (>= 3.0-10) debianutils Depends: sensible-utils PreDepends: libc6 (>= 2.7) sensible-utils libc6 Depends: libc-bin (= 2.11.3-4) Depends: libgcc1 libc-bin libgcc1 Depends: gcc-4.4-base (= 4.4.5-8) Depends: libc6 (>= 2.2.4) gcc-4.4-base lsb-base Depends: ncurses-bin Depends: sed ncurses-bin PreDepends: libc6 (>= 2.3) PreDepends: libncurses5 (>= 5.7+20100313) libncurses5 Depends: libc6 (>= 2.3.4) sed Depends: dpkg (>= 1.15.4) Depends: install-info PreDepends: libc6 (>= 2.3) PreDepends: libselinux1 (>= 1.32) dpkg PreDepends: coreutils (>= 5.93-1) PreDepends: libbz2-1.0 PreDepends: libc6 (>= 2.6) PreDepends: libselinux1 (>= 1.32) PreDepends: xz-utils PreDepends: zlib1g (>= 1:1.1.4) coreutils PreDepends: libacl1 (>= 2.2.11-1) PreDepends: libattr1 (>= 2.4.41-1) PreDepends: libc6 (>= 2.6) PreDepends: libselinux1 (>= 1.32) libacl1 Depends: libattr1 (>= 2.4.41-1) Depends: libc6 (>= 2.2) libattr1 Depends: libc6 (>= 2.2.3) libselinux1 Depends: libc6 (>= 2.3.4) libbz2-1.0 Depends: libc6 (>= 2.3) xz-utils Depends: libc6 (>= 2.6) Depends: liblzma2 (>= 5.0.0) liblzma2 Depends: libc6 (>= 2.3.6-6~) zlib1g Depends: libc6 (>= 2.1.3) install-info Depends: libc6 (>= 2.3.4) [21:52:01] ~ #

* edit *

Héhé … :wink:

[22:14:49] ~ # aptitude why-not anacron i apticron Dépend mailx p mailutils Fournit mailx p mailutils Dépend default-mta | mail-transport-agent p exim4-daemon-light Fournit mail-transport-agent p exim4-daemon-light Dépend exim4-base (>= 4.80) p exim4-base Dépend cron | fcron p fcron Est en conflit avec anacron [22:15:21] ~ #

Bonsoir,

effectivement, tout s’est bien passé, et au démarrage d’aujourd’hui,
je constate qu’effectivement logrotate s’est lancé et a fonctionné
(et certainement tous les autres services prévus par cron)

Donc anacron a bien fait son boulot,

merci de votre aide