[Postfix espanol] PFLOGSUMM.PL
Simon J Mudd
sjmudd en pobox.com
Mar Ene 15 11:51:58 CET 2002
leal en iat.es (Francisco Jose Leal Pino) writes:
> ?Alguien podria decirme como instalar y configurar el pflogsumm.pl, para
> poder ver las estadistica de mi servidor de correo? Tengo linux 6.2 como
> S.O. y postfix como MTA..
1. Bajar pflogsumm.pl de http://jimsun.linxnet.com/downloads/
2. Instalarlo en /usr/sbin
3. copiar 1postfix a /etc/rc.d/init.d/cron.daily
4. Esto mandará un mensaje diario a "root" del contenido del analisis
del fichero /var/log/maillog, justo antes de hacer un "logrotate".
[Nota: 1postfix es un poco complicado porque detecta si tienes una rutina
de perl instalado y en caso de tenerlo instalado lo usa, si no no.]
1postfix debe contener:
-- snip --
#!/bin/sh
#
# /etc/cron.daily/1postfix
#
# This file is run on a daily basis to perform checks on your postfix
# configuration and to analyse your mail logs.
#
# The file is named "1postfix" to ensure that it is run before logrotate
# when the /var/log/maillog files are rotated.
#
# The file is also flagged by rpm as a configuration file, so if you modify
# it, further upgrades to postfix will not be overwriten.
#
# uncomment the next line to completely disable the daily cronjob
# exit 0
LOGFILE=/var/log/maillog
EXECUTABLE=/usr/sbin/pflogsumm.pl
PFLOGSUMTMP=/etc/postfix/pfls.tmp.$$ # safer directory than /tmp
# Clean up when done or when aborting.
trap "rm -f ${PFLOGSUMTMP}" 0 1 2 3 15
[ -x /usr/sbin/postfix ] || exit 0
/usr/sbin/postfix check
# uncomment the next line to disable retrieval of mail statistics
# exit 0
# Invoke pflogsumm.pl to gather statistics
# see http://jimsun.linxnet.com/postfix_contrib.html for further info.
[ -x /usr/sbin/pflogsumm.pl ] || exit 0
# WARNING - This is a bit of a hack
#
# pflogsumm.pl needs Date::Calc to work so we do the following:
# Check if our installation works with Date::Calc
# - if so, use pflogsumm.pl directly
# - if not filter out the Date::Calc useage and use the resulting script
perl -e "use Date::Calc;" 2>/dev/null || {
# strip out Date::Calc from pflogsumm.pl
sed -e '/# ---Begin:/,/# ---End:/d' < ${EXECUTABLE} > ${PFLOGSUMTMP}
chmod u=x,go= ${PFLOGSUMTMP}
EXECUTABLE=${PFLOGSUMTMP}
}
echo "# Daily mail statistics generated by pflogsumm.pl extracted from ${LOGFILE} follows."
echo "# Further information from http://jimsun.linxnet.com/postfix_contrib.html"
echo "# --"
${EXECUTABLE} < ${LOGFILE}
-- snip --
Simon
--
Simon J Mudd, Tel: +34-91-408 4878, Mobile: +34-605-085 219
Madrid, Spain. email: sjmudd en pobox.com, Postfix RPM Packager
-
Para quitarte de la lista enviar la linea "unsubscribe postfix-espanol" en
el cuerpo de un mensaje a majordomo en ea4els.ampr.org
Más información sobre la lista de distribución Postfix-es