Brad Knowles wrote:
>
> I've taken your submission and incorporated that, as well as
>fixing another bug that was brought to my attention by Adrian Wells.
>It turns out that there is a minor log file difference between
>Mailman versions 2.1.5 and 2.1.6, which causes the "smtp" log to be
>written in a slightly different format. The code should now handle
>both styles without problems.
This all looks good. I made a couple of other changes that I meant to
report before now, but never got to it.
I got tired of seeing all the '.' and '..' entries and the 'total'
blocks in the qfiles subdirectory listings so I changed the script as
follows:
@@ -455,7 +457,7 @@
echo "------------------------------" >> $TMP
if [ $LINES -le $MAX_LINES ] ; then
- $CAT $TMPLOG >> $TMP
+ $GREP -v "^[dt]" $TMPLOG >> $TMP
else
$HEAD $TMPLOG >> $TMP
echo "" >> $TMP
to supress the 'total' line and sub-sub-directories although arguably
the total line is interesting to monitor if it grows large.
One could just make the grep
$GREP -v "^d" $TMPLOG >> $TMP
or maybe just change the preceding
$LS -la $DIR >> $TMPLOG
to
$LS -l $DIR >> $TMPLOG
The other thing I changed is due to the fact that the logs are rotated
weekly via logrotate on my installation. This occurs at 04:02 on
Sundays and is beyond my control and caused my report for Sunday to be
missing the 00:00 to 04:02 time period. Even if I did control it, I
think the best I could do would lose a second or two.
Instead, I changed the script as follows to get all the days entries
from both the current and the previous log (if any).
@@ -254,7 +254,8 @@
$TOUCH $TMPLOG
echo "Log file: $LOG" >> $TMP
echo "==============================" >> $TMP
- $GREP -si "^$DAY [0-9][0-9:]* $YEAR" $LOGDIR/$LOG >> $TMPLOG
+ $GREP -si "^$DAY [0-9][0-9:]* $YEAR" ${LOGDIR}/${LOG}.1
${LOGDIR}/${LOG} \
+ | $SED "s/^[^:]*://" >> $TMPLOG
if [ -f "$LOGDIR/${LOG}" ] ; then
@@ -324,7 +325,8 @@
$TOUCH $TMPLOG
echo "Log file: $LOG" >> $TMP
echo "==============================" >> $TMP
- $GREP -si "^$DAY [0-9][0-9:]* $YEAR" $LOGDIR/$LOG >> $TMPLOG
+ $GREP -si "^$DAY [0-9][0-9:]* $YEAR" ${LOGDIR}/${LOG}.1
${LOGDIR}/${LOG} \
+ | $SED "s/^[^:]*://" >> $TMPLOG
if [ -f "$LOGDIR/${LOG}" ] ; then
Watch for wrapped lines above. Also, note the sed which removes the
leading 'filename:' placed on each line by grep.
--
Mark Sapiro <[EMAIL PROTECTED]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
------------------------------------------------------
Mailman-Users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org
Security Policy:
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp