Guten Tag!
Ich hab zur Zeit ein Problem mit logrotate, er arbeitet einfach nicht. Meine syslog wächst von Tag zu Tag weiter ohne das diese Rotiert wird. Das betrifft aber nicht nur diese sondern auch andere log Dateien wie apt.
Erst mal die relevanten Daten zum drüber schauen.
/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
/etc/logrotate.d/rsyslog
/var/log/syslog { rotate 14 daily missingok notifempty delaycompress compress postrotate reload rsyslog >/dev/null 2>&1 || true 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 15 daily missingok notifempty compress delaycompress sharedscripts postrotate reload rsyslog >/dev/null 2>&1 || true endscript }
/etc/cron.daily/logrotate
#!/bin/sh # Clean non existent log file entries from status file cd /var/lib/logrotate test -e status || touch status head -1 status > status.clean sed 's/"//g' status | while read logfile date do [ -e "$logfile" ] && echo "\"$logfile\" $date" done >> status.clean mv status.clean status test -x /usr/sbin/logrotate || exit 0 /usr/sbin/logrotate /etc/logrotate.conf
/etc/crontab
# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) #
Dann habe ich mich erst mal schlau gemacht bezüglich anacron (Cron (Abschnitt „Anacron-Anac-h-ronistic-Cron“)) da es wie man sieht in der crontab steht. Festgestellt habe ich das es gar nicht mit vorinstalliert ist. Da frag ich mich gleich warum das in der Crontab steht aber das Programm dafür gar nicht mit geliefert wird.
Aber egal anacron ist ja eigl auch nur dafür falls der Server mal aus sein sollte und so ein cronjob verpasst wird also eigl. nicht weiter relevant.
Als nächstes hatte ich dann einfach mal versucht logrotate manuell zu starten mit
logrotate -v /etc/logrotate.conf
Dies war nicht sofort von erfolg gekrönt zu erst wollte er nicht. Dann hatte ich dem ganzen einen zweiten Durchlauf gegönnt mit dem parameter -f das hat es dann gebracht und die logs wurden rotiert.
So jetzt muss ich das ganze nur noch wirklich als cronjob zum laufen bringen da es manuell ja geht.
Irgendjemand einen Tipp was ich hier übersehe?
Bevor ich es vergesse in der /var/log befindet sich ja auch der dmesg log, dieser wird als einziger regelmäßig rotiert ohne Probleme. Komischerweise findet ich zu diesem nirgends einen Eintrag keine Ahnung warum oder wieso es bei dem als einziges funktioniert bzw. warum es überhaupt funktioniert da ich zu dem nichts finden kann.