Bonjour à tous,
Depuis cet automne, j’ai des problèmes avec les logs sur mon serveur, qui ne sont pas conservés. Quand j’ai remarqué ça, je n’ai pas compris pourquoi, sachant que je n’avais fait aucune modif récente/conséquente dont je me souvenais, et après avoir cherché un peu sans solution, je me suis dit ‘je verrai plus tard’ (je sais, ce n’est pas bien).
Le temps passant, je me suis décidé à fouiller plus profondément, toujours sans succès. Mais il faut tout de même que je résolve cela, un serveur sans log est tout de même problématique, même un serveur perso qui ne sert presque pas à grand chose…
Ma config :
odroid-c2 avec debian stretch (oui je sais, une old-stable)
serveur php pour de petits projets perso web et serveur mail pour mon courrier perso
Tout fonctionnait sans soucis depuis plusieurs années (des petits problèmes ponctuels bien sûr, mais rien du côté des logs).
Mon problème:
tous les quarts d’heure apparemment (par exemple à 16h30, 16h45, 17h), mes fichiers de log sont vidés, et je vois des (nouveaux?) fichiers qui datent au plus tard de ce moment qui se remplissent à nouveau, selon les événements à enregistrer.
Par exemple, contenu du répertoire de log à 17h11
root@octy:/var/log# ls -l
total 5112
-rw-r--r-- 1 root root 0 Mar 14 17:00 alternatives.log
drwxr-xr-x 2 root root 4096 Feb 14 13:45 apt
-rw-r--r-- 1 root root 0 Jun 1 2018 aptitude
-rw-r--r-- 1 root root 0 Mar 14 17:00 armbian-hardware-monitor.log
-rwxr-xr-x 1 root root 0 Mar 14 17:00 armhwinfo.log
-rw-r----- 1 root adm 810 Mar 14 17:10 auth.log
-rw-r--r-- 1 root root 0 Mar 14 17:00 bootstrap.log
-rw-rw---- 1 root utmp 0 Mar 14 17:00 btmp
drwxr-xr-x 2 clamav clamav 4096 Mar 14 17:00 clamav
-rw-r--r-- 1 clamav clamav 0 Mar 14 17:00 clamav-unofficial-sigs.log
-rw-r----- 1 root adm 0 Mar 14 17:00 daemon.log
drwxr-xr-x 2 root root 4096 Jan 16 16:00 dbconfig-common
-rw-r----- 1 root adm 0 Mar 14 17:00 debug
-rw-r----- 1 root adm 31 Sep 14 2016 dmesg
-rw-r--r-- 1 root root 0 Mar 14 17:00 dpkg.log
-rw-r----- 1 root adm 0 Mar 14 17:00 fail2ban.log
-rw-r--r-- 1 root root 0 Mar 14 17:00 faillog
-rw-r--r-- 1 root root 0 Mar 14 17:00 fontconfig.log
drwxr-xr-x 2 root root 4096 Sep 14 2016 fsck
-rw-r----- 1 root adm 8237 Mar 14 17:11 kern.log
-rw-rw-r-- 1 root utmp 0 Mar 14 17:00 lastlog
drwx------ 2 root root 40960 Mar 14 12:15 letsencrypt
-rw-r--r-- 1 root root 0 Mar 14 17:00 lpr.log
-rw-r----- 1 root adm 0 Mar 14 10:30 mail.err
-rw-r----- 1 root adm 3605 Mar 14 17:11 mail.info
-rw-r----- 1 root adm 3605 Mar 14 17:11 mail.log
-rw-r--r-- 1 root root 3797 Feb 6 2019 mail.readme
-rw-r----- 1 root adm 858 Mar 14 17:11 mail.warn
-rw-r----- 1 root adm 8237 Mar 14 17:11 messages
drwxr-s--- 2 mysql adm 4096 Mar 14 17:00 mysql
-rw-r----- 1 mysql adm 0 Apr 26 2017 mysql.err
-rw-r----- 1 mysql adm 0 Mar 14 17:00 mysql.log
drwxr-xr-x 2 root root 4096 Feb 14 12:40 news
drwxr-xr-x 2 root adm 4096 Mar 11 23:45 nginx
drwxr-xr-x 2 ntp ntp 4096 Jul 22 2016 ntpstats
-rw------- 1 root root 0 Mar 14 17:00 php7.0-fpm.log
drwxrwxr-x 2 www-data www-data 4096 Nov 29 15:09 roundcube
drwxr-xr-x 2 stunnel4 stunnel4 4096 Nov 27 2018 stunnel4
-rw-r----- 1 root adm 12173 Mar 14 17:11 syslog
drwxr-xr-x 2 root root 4096 Oct 3 2014 sysstat
drwxr-x--- 2 root adm 4096 Jan 16 16:00 unattended-upgrades
-rw-r----- 1 root adm 0 Mar 14 17:00 user.log
-rw-r--r-- 1 root root 0 Mar 14 17:00 uucp.log
-rw-rw-r-- 1 root root 0 Mar 14 17:00 verif_mailq_postfix.log
-rw-rw-r-- 1 root utmp 0 Mar 14 17:00 wtmp
-rw-r--r-- 1 root root 0 Mar 14 17:00 yunohost-installation.log
Contenu du répertoire à 17h15 :
root@octy:/var/log# ls -l
total 5076
-rw-r--r-- 1 root root 0 Mar 14 17:15 alternatives.log
drwxr-xr-x 2 root root 4096 Feb 14 13:45 apt
-rw-r--r-- 1 root root 0 Jun 1 2018 aptitude
-rw-r--r-- 1 root root 0 Mar 14 17:15 armbian-hardware-monitor.log
-rwxr-xr-x 1 root root 0 Mar 14 17:15 armhwinfo.log
-rw-r----- 1 root adm 87 Mar 14 17:15 auth.log
-rw-r--r-- 1 root root 0 Mar 14 17:15 bootstrap.log
-rw-rw---- 1 root utmp 0 Mar 14 17:15 btmp
drwxr-xr-x 2 clamav clamav 4096 Mar 14 17:15 clamav
-rw-r--r-- 1 clamav clamav 0 Mar 14 17:15 clamav-unofficial-sigs.log
-rw-r----- 1 root adm 0 Mar 14 17:15 daemon.log
drwxr-xr-x 2 root root 4096 Jan 16 16:00 dbconfig-common
-rw-r----- 1 root adm 0 Mar 14 17:15 debug
-rw-r----- 1 root adm 31 Sep 14 2016 dmesg
-rw-r--r-- 1 root root 0 Mar 14 17:15 dpkg.log
-rw-r----- 1 root adm 0 Mar 14 17:15 fail2ban.log
-rw-r--r-- 1 root root 0 Mar 14 17:15 faillog
-rw-r--r-- 1 root root 0 Mar 14 17:15 fontconfig.log
drwxr-xr-x 2 root root 4096 Sep 14 2016 fsck
-rw-r----- 1 root adm 242 Mar 14 17:15 kern.log
-rw-rw-r-- 1 root utmp 0 Mar 14 17:15 lastlog
drwx------ 2 root root 40960 Mar 14 12:15 letsencrypt
-rw-r--r-- 1 root root 0 Mar 14 17:15 lpr.log
-rw-r----- 1 root adm 0 Mar 14 10:30 mail.err
-rw-r----- 1 root adm 0 Mar 14 17:15 mail.info
-rw-r----- 1 root adm 0 Mar 14 17:15 mail.log
-rw-r--r-- 1 root root 3797 Feb 6 2019 mail.readme
-rw-r----- 1 root adm 0 Mar 14 17:15 mail.warn
-rw-r----- 1 root adm 242 Mar 14 17:15 messages
drwxr-s--- 2 mysql adm 4096 Mar 14 17:15 mysql
-rw-r----- 1 mysql adm 0 Apr 26 2017 mysql.err
-rw-r----- 1 mysql adm 0 Mar 14 17:15 mysql.log
drwxr-xr-x 2 root root 4096 Feb 14 12:40 news
drwxr-xr-x 2 root adm 4096 Mar 11 23:45 nginx
drwxr-xr-x 2 ntp ntp 4096 Jul 22 2016 ntpstats
-rw------- 1 root root 0 Mar 14 17:15 php7.0-fpm.log
drwxrwxr-x 2 www-data www-data 4096 Nov 29 15:09 roundcube
drwxr-xr-x 2 stunnel4 stunnel4 4096 Nov 27 2018 stunnel4
-rw-r----- 1 root adm 242 Mar 14 17:15 syslog
drwxr-xr-x 2 root root 4096 Oct 3 2014 sysstat
drwxr-x--- 2 root adm 4096 Jan 16 16:00 unattended-upgrades
-rw-r----- 1 root adm 0 Mar 14 17:15 user.log
-rw-r--r-- 1 root root 0 Mar 14 17:15 uucp.log
-rw-rw-r-- 1 root root 0 Mar 14 17:15 verif_mailq_postfix.log
-rw-rw-r-- 1 root utmp 0 Mar 14 17:15 wtmp
-rw-r--r-- 1 root root 0 Mar 14 17:15 yunohost-installation.log
(dans les sous répertoires de /var/log/*, le processus est le même)
(si je mets un fichier dedans qui n’a pas un nom de fichier de log standard, par exemple test.txt, il n’est pas modifié)
logrotate fait normalement une rotation des logs “weekly”, je n’ai donc pas l’impression que cela soit ça mais je peux me tromper.
La première entrée de log après un nouveau quart d’heure n’a rien à voir dans /var/log/syslog ou dans /var/log/messages, donc je manque vraiment d’indice, d’où mon message ici.
Cela sera peut-être évident pour certains mais je n’ai rien trouvé via moteur de recherche.
Merci beaucoup si vous avez des pistes pour moi !