PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Logrotate anstatt Syslog bei Debian



Eddie
07.04.05, 08:04
Hallo,

wie kann ich bei Debian das Rotieren der Maillogs aus dem Syslog rauslösen? Syslog soll Maillogs nur schreiben, rotieren soll logrotate.

Habe nämlich bei Syslog keine Konfig für das Rotiern gefunden. Würde gerne andere Aufbewahrungsdauer und Häufigkeit einstellen. Falls es dort wie beim Logrotate prerotate- und postrotate-Bereiche gibt (für Statistikskripte, etc.) bin ich auch zufrieden. Hab es bis jetzt nur nicht etdeckt...



mfg

Tomek
07.04.05, 09:59
Syslog rotiert definitiv keine Logfiles. Das macht ganz alleine das Tool logrotate. Lograte konfigurierst du in der Datei /etc/logrotate.conf und in den einzelnen Dateien im Verzeichnis /etc/logrotate.d/. Hilfe zu Logrotate erhälst in der Manpage zu logrotate und auch bei Google.

In der Syslog-Konfiguration bestimmst du nur, welche Meldungen wohin protokolliert werden sollen.

Eddie
07.04.05, 15:15
Von anderen OS kenne ich das auch so, aber scheinbar nicht bei Debian.

Wenn man

/usr/sbin/syslogd-listfiles -a

aufruft, sieht man, was von syslog geloggt und rotiert wird. Sowei ich weis war logrotate anfangs gar nicht installiert.
Jetzt habe ich nur eine Datei drin:

base-config

Laut deiner Aussage können dann kein Mail Logs rotiert werden.

Die Aussage dass syslog rotiert, habe ich von googeln. Die Frage ist nach wie vor: wie kann ich das Maill Log dort beim syslog rauslösen und vom logrotate rotieren lassen?




mfg

Tomek
07.04.05, 15:22
Nochmal: Syslog rotiert keine Logdateien.

Eddie
07.04.05, 16:20
Ne, überhaupt net...




antirelay2:~# cat /etc/cron.daily/sysklogd
#! /bin/sh

# sysklogd Cron script to rotate system log files daily.
#
# If you want to rotate other logfiles daily, edit
# this script. An easy way is to add files manually,
# to add -a (for all log files) to syslogd-listfiles and
# add some grep stuff, or use the -s pattern argument to
# specify files that must not be listed.
#
# 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.

Tomek
07.04.05, 16:29
Schon mal weiter im Skript geschaut, was es genau tut?

test -x /usr/sbin/syslogd-listfiles || exit 0
test -x /sbin/syslogd || exit 0
test -f /usr/share/sysklogd/dummy || exit 0

set -e

cd /var/log
for LOG in `syslogd-listfiles`
do
if [ -s $LOG ]; then
savelog -g adm -m 640 -u root -c 7 $LOG >/dev/null
fi
done

for LOG in `syslogd-listfiles --auth`
do
if [ -f $LOG ]; then
chown root:adm $LOG
chmod o-rwx $LOG
fi
done

# Restart syslogd
#
/etc/init.d/sysklogd reload-or-restart > /dev/null
Immernoch der Meinung, dass Syslog Logfiles rotiert?

Eddie
13.04.05, 13:38
Schon mal im /etc/cron.weekly/sysklogd geschaut?



#! /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).
#
# 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.10 2004/03/31 16:18:15 joey Exp $

test -x /usr/sbin/syslogd-listfiles || exit 0
test -x /sbin/syslogd || exit 0
test -f /usr/share/sysklogd/dummy || 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 > /dev/null


Führt man syslogd-listfiles --weekly aus bekommt man die Datein aufgelistet, die er wöchentlich rotiert:


/var/log/mail.warn
/var/log/uucp.log
/var/log/user.log
/var/log/daemon.log
/var/log/messages
/var/log/debug
/var/log/auth.log
/var/log/mail.err
/var/log/mail.log
/var/log/kern.log
/var/log/lpr.log


Abhilfe schafft die ergänzung der Zeile um '-s mail': syslogd-listfiles --weekly -s mail

Listet man jetz die Logs auf, die wöch. rotiert werden...
[/CODE]
/var/log/uucp.log
/var/log/user.log
/var/log/daemon.log
/var/log/messages
/var/log/debug
/var/log/auth.log
/var/log/kern.log
/var/log/lpr.log
[CODE]

Ab jetz hat logrotate die volle Kontrolle über die Mail Logs!


Immer noch der Meinung, dass Syslog nichts rotiert?

Tomek
13.04.05, 13:46
Hmm, dann habe ich wieder etwas dazu gelernt. Okay. :)