patches for eximstats and eximon (his patch dealt with exigrep).
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.466 2007/01/31 11:30:08 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.467 2007/01/31 16:52:12 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
PH/13 Added ${rfc2047d: to decoded RFC 2047 strings.
+PH/14 Added log_selector = +pid.
+
Exim version 4.66
-----------------
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.133 2007/01/31 11:30:08 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.134 2007/01/31 16:52:12 ph10 Exp $
New Features in Exim
--------------------
headers_charset. Overlong RFC 2047 "words" are not recognized unless
check_rfc2047_length is set false.
+10. There is a new log selector called "pid", which causes the current process
+ id to be added to every log line, in square brackets, immediately after the
+ time and date.
+
Version 4.66
------------
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.70 2007/01/31 11:30:08 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.71 2007/01/31 16:52:12 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
Peter Savitch Diagnosis of FPE bug when statvfs() fails on spool
Harald Schueler Patch for dn_expand() failure on truncated data
Heiko Schlichting Diagnosis of intermittent daemon crash bug
+Heiko Schlitterman Proposed patch for +pid
Stephan Schulz Patch for $host_data caching error
Lai Zit Seng Patch for radiusclient 0.4.9 interface bugs
Tony Sheen Log files with datestamped names and auto rollover
-/* $Cambridge: exim/src/exim_monitor/em_log.c,v 1.4 2007/01/08 10:50:17 ph10 Exp $ */
+/* $Cambridge: exim/src/exim_monitor/em_log.c,v 1.5 2007/01/31 16:52:12 ph10 Exp $ */
/*************************************************
* Exim Monitor *
/* Copyright (c) University of Cambridge 1995 - 2007 */
/* See the file NOTICE for conditions of use and distribution. */
-/* This module contains code for scanning the smaill log,
+/* This module contains code for scanning the main log,
extracting information from it, and displaying a "tail". */
#include "em_hdr.h"
}
/* Munge the log entry and display shortened form on one line.
- We omit the date and show only the time. Remove any time zone offset. */
+ We omit the date and show only the time. Remove any time zone offset.
+ Take note of the presence of [pid]. */
if (pcre_exec(yyyymmdd_regex,NULL,CS buffer,length,0,PCRE_EOPT,NULL,0) >= 0)
{
+ int pidlength = 0;
if ((buffer[20] == '+' || buffer[20] == '-') &&
isdigit(buffer[21]) && buffer[25] == ' ')
memmove(buffer + 20, buffer + 26, Ustrlen(buffer + 26) + 1);
- id = string_copyn(buffer + 20, MESSAGE_ID_LENGTH);
+ if (buffer[20] == '[')
+ {
+ while (Ustrchr("[]0123456789", buffer[20+pidlength++]) != NULL);
+ }
+ id = string_copyn(buffer + 20 + pidlength, MESSAGE_ID_LENGTH);
show_log("%s", buffer+11);
}
else
-/* $Cambridge: exim/src/exim_monitor/em_version.c,v 1.4 2007/01/08 10:50:17 ph10 Exp $ */
+/* $Cambridge: exim/src/exim_monitor/em_version.c,v 1.5 2007/01/31 16:52:12 ph10 Exp $ */
/*************************************************
* Exim Monitor *
int i = 0;
uschar today[20];
-version_string = US"2.05";
+version_string = US"2.06";
Ustrcpy(today, __DATE__);
if (today[4] == ' ') i = 1;
#! PERL_COMMAND -w
-# $Cambridge: exim/src/src/exigrep.src,v 1.3 2005/08/01 13:28:30 ph10 Exp $
+# $Cambridge: exim/src/src/exigrep.src,v 1.4 2007/01/31 16:52:12 ph10 Exp $
use strict;
-# Copyright (c) 2004 University of Cambridge.
+# Copyright (c) 2007 University of Cambridge.
# See the file NOTICE for conditions of use and distribution.
# Except when they appear in comments, the following placeholders in this
# Handle the case when the log line belongs to a specific message. We save
# lines for specific messages until the message is complete. Then either print
-# discard.
+# or discard.
-if (my($id) = $entry =~ /^(\w{6}\-\w{6}\-\w{2})/)
+if (my($id) = $entry =~ /^(?:\[\d+\]\s)?(\w{6}\-\w{6}\-\w{2})/)
{
$saved{$id} = '' unless defined($saved{$id});
#!PERL_COMMAND -w
-# $Cambridge: exim/src/src/eximstats.src,v 1.12 2007/01/22 15:14:01 steve Exp $
+# $Cambridge: exim/src/src/eximstats.src,v 1.13 2007/01/31 16:52:12 ph10 Exp $
# Copyright (c) 2001 University of Cambridge.
# See the file NOTICE for conditions of use and distribution.
# 2006-11-27 V1.52 Steve Campbell
# Tally any reject message containing SpamAssassin.
#
+# 2007-01-31 V1.53 Philip Hazel
+# Allow for [pid] after date in log lines
+#
#
#
# For documentation on the logfile format, see
@days_per_month = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);
$gig = 1024 * 1024 * 1024;
-$VERSION = '1.52';
+$VERSION = '1.53';
# How much space do we allow for the Hosts/Domains/Emails/Edomains column headers?
$COLUMN_WIDTHS = 8;
$length = length($_);
next if ($length < 38);
- next unless /^(\\d{4}\\-\\d\\d-\\d\\d\\s(\\d\\d):(\\d\\d):\\d\\d( [-+]\\d\\d\\d\\d)?)/o;
+ next unless /^(\\d{4}\\-\\d\\d-\\d\\d\\s(\\d\\d):(\\d\\d):\\d\\d( [-+]\\d\\d\\d\\d)?)( \\[\\d+\\])?/o;
($tod,$m_hour,$m_min) = ($1,$2,$3);
$extra = 0;
}
+ # PH - watch for PID added after the timestamp.
+ if (defined($5)) {
+ $extra += length($5);
+ next if ($length < 38 + $extra);
+ }
+
$id = substr($_, 20 + $extra, 16);
$flag = substr($_, 37 + $extra, 2);
-/* $Cambridge: exim/src/src/globals.c,v 1.66 2007/01/30 15:10:59 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.67 2007/01/31 16:52:12 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
independently. This separation became necessary when the number of log
selectors was getting close to filling a 32-bit word. */
+/* Note that this list must be in alphabetical order. */
+
bit_table log_options[] = {
{ US"acl_warn_skipped", LX_acl_warn_skipped },
{ US"address_rewrite", L_address_rewrite },
{ US"incoming_port", LX_incoming_port },
{ US"lost_incoming_connection", L_lost_incoming_connection },
{ US"outgoing_port", LX_outgoing_port },
+ { US"pid", LX_pid },
{ US"queue_run", L_queue_run },
{ US"queue_time", LX_queue_time },
{ US"queue_time_overall", LX_queue_time_overall },
-/* $Cambridge: exim/src/src/log.c,v 1.11 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/src/src/log.c,v 1.12 2007/01/31 16:52:12 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
id except for the process log and when called by a utility. */
ptr = log_buffer;
+sprintf(CS ptr, "%s ", tod_stamp(tod_log));
+while(*ptr) ptr++;
+
+if ((log_extra_selector & LX_pid) != 0)
+ {
+ sprintf(CS ptr, "[%d] ", (int)getpid());
+ while (*ptr) ptr++;
+ }
+
if (really_exim && (flags & LOG_PROCESS) == 0 && message_id[0] != 0)
- sprintf(CS ptr, "%s %s ", tod_stamp(tod_log), message_id);
-else sprintf(CS ptr, "%s ", tod_stamp(tod_log));
+ {
+ sprintf(CS ptr, "%s ", message_id);
+ while(*ptr) ptr++;
+ }
-while(*ptr) ptr++;
if ((flags & LOG_CONFIG) != 0) ptr = log_config_info(ptr, flags);
va_start(ap, format);
-/* $Cambridge: exim/src/src/macros.h,v 1.30 2007/01/15 15:59:22 ph10 Exp $ */
+/* $Cambridge: exim/src/src/macros.h,v 1.31 2007/01/31 16:52:12 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
#define LX_incoming_interface 0x80000020
#define LX_incoming_port 0x80000040
#define LX_outgoing_port 0x80000080
-#define LX_queue_time 0x80000100
-#define LX_queue_time_overall 0x80000200
-#define LX_received_sender 0x80000400
-#define LX_received_recipients 0x80000800
-#define LX_rejected_header 0x80001000
-#define LX_return_path_on_delivery 0x80002000
-#define LX_sender_on_delivery 0x80004000
-#define LX_sender_verify_fail 0x80008000
-#define LX_smtp_confirmation 0x80010000
-#define LX_smtp_no_mail 0x80020000
-#define LX_subject 0x80040000
-#define LX_tls_certificate_verified 0x80080000
-#define LX_tls_cipher 0x80100000
-#define LX_tls_peerdn 0x80200000
-#define LX_unknown_in_list 0x80400000
+#define LX_pid 0x80000100
+#define LX_queue_time 0x80000200
+#define LX_queue_time_overall 0x80000400
+#define LX_received_sender 0x80000800
+#define LX_received_recipients 0x80001000
+#define LX_rejected_header 0x80002000
+#define LX_return_path_on_delivery 0x80004000
+#define LX_sender_on_delivery 0x80008000
+#define LX_sender_verify_fail 0x80010000
+#define LX_smtp_confirmation 0x80020000
+#define LX_smtp_no_mail 0x80040000
+#define LX_subject 0x80080000
+#define LX_tls_certificate_verified 0x80100000
+#define LX_tls_cipher 0x80200000
+#define LX_tls_peerdn 0x80400000
+#define LX_unknown_in_list 0x80800000
#define L_default (L_connection_reject | \
L_delay_delivery | \
-$Cambridge: exim/test/README,v 1.6 2007/01/23 11:01:10 ph10 Exp $
+$Cambridge: exim/test/README,v 1.7 2007/01/31 16:52:12 ph10 Exp $
EXPORTABLE EXIM TEST SUITE
--------------------------
This document last updated for:
Test Suite Version: 4.67
-Date: 23 January 2007
+Date: 31 January 2007
BACKGROUND
This command runs the exinext utility with the given argument data.
+ exigrep <data>
+
+This command runs the exigrep utility with the given data (the search pattern)
+on the current mainlog file.
+
+
gnutls
This command is present at the start of all but one of the tests that use
--- /dev/null
+# Exim test configuration 0551
+
+LS=+pid
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+log_selector = LS
+
+# ----- Routers -----
+
+begin routers
+
+r1:
+ driver = accept
+ transport = t1
+
+
+# ----- Transports -----
+
+begin transports
+
+t1:
+ driver = appendfile
+ user = CALLER
+ file = DIR/test-mail/$local_part
+
+# End
--- /dev/null
+1999-03-02 09:44:33 [1234] 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 [1235] 10HmaX-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1235] 10HmaX-0005vi-00 => usery <usery@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1235] 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 [1236] 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 [1237] 10HmaY-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1237] 10HmaY-0005vi-00 => userz <userz@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1237] 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
--- /dev/null
+From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by myhost.test.ex with local (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaX-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Message 1
+
+From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by myhost.test.ex with local (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaY-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaY-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Message 2
+
+From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by myhost.test.ex with local (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaZ-0005vi-00
+ for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaZ-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Message 3
+
--- /dev/null
+From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by myhost.test.ex with local (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaX-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Message 1
+
--- /dev/null
+From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by myhost.test.ex with local (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaY-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaY-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Message 2
+
#! /usr/bin/perl -w
-# $Cambridge: exim/test/runtest,v 1.22 2007/01/23 14:57:51 ph10 Exp $
+# $Cambridge: exim/test/runtest,v 1.23 2007/01/31 16:52:12 ph10 Exp $
###############################################################################
# This is the controlling script for the "new" test suite for Exim. It should #
# Time on queue tolerance
s/QT=1s/QT=0s/;
+ # Eximstats heading
+ s/Exim\sstatistics\sfrom\s\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d\sto\s
+ \d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d/Exim statistics from <time> to <time>/x;
+
# ======== Caller's login, uid, gid, home ========
# Pid in temp file in appendfile transport
s"test-mail/temp\.\d+\."test-mail/temp.pppp.";
+ # Optional pid in log lines
+ s/^(\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d)(\s[+-]\d\d\d\d|)(\s\[\d+\])/
+ "$1$2 [" . new_value($3, "%s", \$next_pid) . "]"/gxe;
+
# Detect a daemon stderr line with a pid and save the pid for subsequent
# removal from following lines.
$spid = $1 if /^(\s*\d+) (?:listening|LOG: MAIN|(?:daemon_smtp_port|local_interfaces) overridden by)/;
s/\+0100,\d+;/+0100,ddd;/;
s/\(\d+ bytes written\)/(ddd bytes written)/;
s/added '\d+ 1'/added 'ddd 1'/;
+ s/Received\s+\d+/Received nnn/;
+ s/Delivered\s+\d+/Delivered nnn/;
# ======== Values in spool space failure message ========
}
+# The "exigrep" command runs exigrep on the current mainlog
+
+if (/^exigrep\s+(.*)/)
+ {
+ run_system("(./eximdir/exigrep " .
+ "$1 $parm_cwd/spool/log/mainlog;" .
+ "echo exigrep exit code = \$?)" .
+ ">>test-stdout");
+ return 1;
+ }
+
+
+# The "eximstats" command runs eximstats on the current mainlog
+
+if (/^eximstats\s+(.*)/)
+ {
+ run_system("(./eximdir/eximstats " .
+ "$1 $parm_cwd/spool/log/mainlog;" .
+ "echo eximstats exit code = \$?)" .
+ ">>test-stdout");
+ return 1;
+ }
+
+
# The "gnutls" command makes a copy of saved GnuTLS parameter data in the
# spool directory, to save Exim from re-creating it each time.
tests_exit(-1, "Failed to make a copy of exinext: $!");
}
+if (system("cp $parm_exim_dir/exigrep eximdir") != 0)
+ {
+ tests_exit(-1, "Failed to make a copy of exigrep: $!");
+ }
+
+if (system("cp $parm_exim_dir/eximstats eximdir") != 0)
+ {
+ tests_exit(-1, "Failed to make a copy of eximstats: $!");
+ }
+
##################################################
# Check that the Exim user can access stuff #
undef %cache;
$next_msgid = "aX";
+ $next_pid = 1234;
$next_port = 1111;
$message_skip = 0;
$msglog_skip = 0;
--- /dev/null
+# log_selector = +pid
+#
+exim -odi userx@test.ex usery@test.ex
+Message 1
+****
+exim -odi userx@test.ex userz@test.ex
+Message 2
+****
+exim -DLS= -odi userx@test.ex
+Message 3
+****
+exigrep userx
+eximstats -ne -nr -nt -tnl -q0 -h0 -t0
+no_msglog_check
--- /dev/null
+1999-03-02 09:44:33 [1234] 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 [1235] 10HmaX-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1235] 10HmaX-0005vi-00 => usery <usery@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1235] 10HmaX-0005vi-00 Completed
+
+1999-03-02 09:44:33 [1236] 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 [1237] 10HmaY-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1237] 10HmaY-0005vi-00 => userz <userz@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 [1237] 10HmaY-0005vi-00 Completed
+
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
+
+exigrep exit code = 0
+
+Exim statistics from <time> to <time>
+
+Grand total summary
+-------------------
+ At least one address
+ TOTAL Volume Messages Addresses Hosts Delayed Failed
+ Received nnn 3 1 0 0.0% 0 0.0%
+ Delivered nnn 5 5 1
+
+eximstats exit code = 0