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: [url]http://orawski.pl/~kpilch/forum/dug/[/url]
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:
[b]root@hobbit:/etc/logrotate.d# logrotate -f /etc/logrotate.d/apache[/b]
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
Time (s) | Query |
---|---|
0.00011 | SET CHARSET latin2 |
0.00004 | SET NAMES latin2 |
0.00117 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='3.141.32.16' WHERE u.id=1 |
0.00082 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.141.32.16', 1738298555) |
0.00066 | SELECT * FROM punbb_online WHERE logged<1738298255 |
0.00069 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=2374 AND t.moved_to IS NULL |
0.00006 | SELECT search_for, replace_with FROM punbb_censoring |
0.00134 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=2374 ORDER BY p.id LIMIT 0,25 |
0.00082 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=2374 |
Total query time: 0.00571 s |