Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Wczoraj z przerażeniem stwierdziłem że system plików na serwerku jest blisk przepełnienia. No to szybko go odchudziłem usuwając pare dużych plików śmieci. Dalsze moje śledztwo wykazało że katalog /var/log zawiera 9,5 GB, co mnie przeraziło. Okazuje sie że logrotate źle mi rotuje logi :(
Oto co mi wypluł jak mu zapodałem:
root@hobbit:/var/log# logrotate -f /etc/logrotate.conf /tmp/logrotate.shD6C3: kill: (12312) - Nie ma takiego procesu error: error running postrotate script Stopping Mail Transport Agent: sendmail. Stopping system log daemon: syslogd. sendmail-mta: no process killed error: error running prerotate script, leaving old log in place cat: /var/run/syslogd.pid: Nie ma takiego pliku ani katalogu Usage: kill pid ... Send SIGTERM to every process listed. kill signal pid ... Send a signal to every process listed. kill -s signal pid ... Send a signal to every process listed. kill -l List all signal names. kill -L List all signal names in a nice table. kill -l signal Convert between signal numbers and names.
oto zawartość pliku /etc/logrotate.conf:
kpilch@hobbit:~$ cat /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 0664 root utmp rotate 1 }
Pozostałe pliki konfiguracyjne logrotate są tu: http://orawski.pl/~kpilch/forum/dug/
Nie mam też wpisu do crona. Jak on wg. was powinien wyglądać?
No jest w katalogu wpis /etc/cron/weekly pewien skrypt sysklogd:
#! /bin/sh # sysklogd Cron script to rotate system log files weekly. # # If you want to rotate logfiles daily, edit # this script and /etc/cron.daily/sysklogd to get # the logfiles in sync (they must not occur in both # files). Do not delete this file itself, since # it will then be replaced after an upgrade creating # unwanted effects. # # This is a configration file. You are invited to edit # it and maintain it on your own. You'll have to do # that if you don't like the default policy # wrt. rotating logfiles (i.e. with large logfiles # weekly and daily rotation may interfere). If you edit # this file and don't let dpkg upgrade it, you have full # control over it. Please read the manpage to # syslogd-listfiles. # # Written by Ian A. Murdock <imurdock@debian.org>. # $Id: cron.weekly,v 1.7 2002/01/01 11:41:36 joey Exp $ test -x /usr/sbin/syslogd-listfiles || exit 0 test -x /sbin/syslogd || exit 0 test -d /usr/share/doc/sysklogd || exit 0 set -e cd /var/log for LOG in `syslogd-listfiles --weekly` do if [ -s $LOG ]; then savelog -g adm -m 640 -u root -c 4 $LOG >/dev/null fi done # Restart syslogd # /etc/init.d/sysklogd reload-or-restart
ale nie wiem jak on dizał i czy to jest bezpieczne.
Postanowiłem też posprzątać w /var/log/apache i zapodałem:
root@hobbit:/etc/logrotate.d# logrotate -f /etc/logrotate.d/apache
error: Failed to remove old log /var/log/apache/access.log.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/error.log.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/alima.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/anonym.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/art7.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/barka.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/internet.orawski.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/jablonka.ug.gov.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/mail.orawski.pl.err.1.gz: No such file or directory error: Failed to remove old log /var/log/apache/mambo.maldoren.net.err.1.gz: No such file or directory
nie rozumiem tego czemu sie tak zachowuje. czy to kwestia uprawnień? przecież uruchomiłem go spod roota.
Offline