[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hylafax
Subject:    Re: [hylafax-users] Problem with logging..
From:       Lee Howard <faxguy () howardsilvan ! com>
Date:       2006-10-25 20:09:53
Message-ID: 453FC491.1060603 () howardsilvan ! com
[Download RAW message or body]

Rob Poe wrote:

>And that's where I think that HylaFax should be improved ..
>
>Even with HylaFax+ and the use of the FaxAccounting script, to offload
>the script parsing that would have to happen (on the HylaFax release)
>... the xferfaxlog logging is just not verbose enough..
>

Attached is a patch which adds a "jobinfo" field to xferfaxlog as the 
20th position.  It's a formatted field with slashes ("/") as delimiters 
bewteen the following pieces of information (in the following order):

  totpages / ntries / ndials / totdials / maxdials / tottries / maxtries

totpages: the number of total pages to be sent in this job
ntries: the number of tries* that have been made so far on the current page
ndials: the number of consecutive failed dials in this job
totdials: the total number of dials for this job thus far
maxdials: the maximum permitted number of dials for this job
tottries: the total number of tries* that have been made on the job
maxtries: the maximum number of tries* that will be permitted

(* tries refer to a call that is answered and where handshaking occurs)

I debated for a bit whether or not to include this information with the 
"npages" (number of pages sent) field that already is stored in 
xferfaxlog... but decided to add a field instead of redefining the 
"npages" field.

Yet, even with this information being added, there still may be some 
more information in the q-file that isn't in the xferfaxlog... and I'm 
not sure all of it is appropriate in logging.

Lee.

["hylafax-xferfaxlog-jobinfo.patch" (text/x-patch)]

diff -Nru hylafax.orig/faxd/FaxAcctInfo.c++ hylafax/faxd/FaxAcctInfo.c++
--- hylafax.orig/faxd/FaxAcctInfo.c++	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/FaxAcctInfo.c++	2006-10-25 12:40:02.249071920 -0700
@@ -90,6 +90,7 @@
 	record.fput("\t\"%s\"", (const char*) callid_formatted);	// $17 = CallID3 -> \
CallIDn  record.fput("\t\"%s\"", owner);					// $18 = owner
 	record.fput("\t\"%s\"", (const char*) faxdcs);			// $19 = DCS
+	record.fput("\t%s", (const char*) jobinfo);			// $20 = jobinfo
 	record.put('\n');
 	flock(fd, LOCK_EX);
 	ok = (Sys::write(fd, record, record.getLength()) == (ssize_t)record.getLength());
@@ -121,7 +122,8 @@
     argv[17] = (const char*) callid_formatted;
     argv[18] = owner;
     argv[19] = (const char*) faxdcs;
-    argv[20] = NULL;
+    argv[20] = (const char*) jobinfo;
+    argv[21] = NULL;
     pid_t pid = fork();		// signal handling in some apps seems to require a fork \
here  switch (pid) {
 	case 0:
diff -Nru hylafax.orig/faxd/FaxAcctInfo.h hylafax/faxd/FaxAcctInfo.h
--- hylafax.orig/faxd/FaxAcctInfo.h	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/FaxAcctInfo.h	2006-10-25 12:39:47.413327296 -0700
@@ -47,6 +47,7 @@
     CallID	callid;		// call identification
     const char* owner;		// job owner (uid)
     fxStr	faxdcs;		// negotiated DCS parameters
+    fxStr	jobinfo;	// totpages, ntries, ndials, totdials, maxdials, tottries, \
maxtries  
     bool record(const char* cmd);
 };
diff -Nru hylafax.orig/faxd/faxGettyApp.c++ hylafax/faxd/faxGettyApp.c++
--- hylafax.orig/faxd/faxGettyApp.c++	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/faxGettyApp.c++	2006-10-25 10:57:30.035350568 -0700
@@ -460,6 +460,7 @@
     ai.status = emsg;
     ai.duration = Sys::now() - ai.start;
     ai.conntime = ai.duration;
+    ai.jobinfo = "";
     if (logCalls && !ai.record("CALL"))
 	logError("Error writing CALL accounting record, dest=%s",
 	    (const char*) ai.dest);
@@ -828,6 +829,7 @@
     ai.jobtag = "";
     ai.callid = ri.callid;
     ai.owner = "";
+    ai.jobinfo = "";
     ri.params.asciiEncode(ai.faxdcs);
     if (!ai.record("RECV"))
 	logError("Error writing RECV accounting record, dest=%s",
diff -Nru hylafax.orig/faxd/faxQueueApp.c++ hylafax/faxd/faxQueueApp.c++
--- hylafax.orig/faxd/faxQueueApp.c++	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/faxQueueApp.c++	2006-10-25 12:41:03.926695496 -0700
@@ -2091,9 +2091,13 @@
     ai.device = "";
     ai.dest = (const char*) req.external;
     ai.csi = "";
-    ai.npages = 0;
+    ai.npages = req.npages;
     ai.params = 0;
-    ai.status = "";
+    if (req.status == send_done)
+	ai.status = "";
+    else {
+	ai.status = req.notice;
+    }
     if (strstr(type, "UNSENT"))
 	ai.status = "Kill time expired";
     else if (strstr(type, "SUBMIT"));
@@ -2102,6 +2106,8 @@
     ai.callid = empty_callid;
     ai.owner = (const char*) req.owner;
     ai.faxdcs = "";
+    ai.jobinfo = fxStr::format("%u/%u/%u/%u/%u/%u/%u", 
+	req.totpages, req.ntries, req.ndials, req.totdials, req.maxdials, req.tottries, \
req.maxtries);  pid_t pid = fork();
     switch (pid) {
 	case -1:			// error
diff -Nru hylafax.orig/faxd/FaxRequest.h hylafax/faxd/FaxRequest.h
--- hylafax.orig/faxd/FaxRequest.h	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/FaxRequest.h	2006-10-25 10:33:21.750523328 -0700
@@ -108,7 +108,7 @@
     u_short	state;		// job scheduling state
     u_short	lineno;		// line number when reading queue file
     FaxSendStatus status;	// request status indicator
-    u_short	totpages;	// total cummulative pages in documents
+    u_short	totpages;	// total cumulative pages in documents
     u_short	npages;		// total pages sent/received
     u_short	ntries;		// # tries to send current page
     u_short	ndials;		// # consecutive failed tries to call dest
diff -Nru hylafax.orig/faxd/faxSendApp.c++ hylafax/faxd/faxSendApp.c++
--- hylafax.orig/faxd/faxSendApp.c++	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/faxSendApp.c++	2006-10-25 12:50:15.773801984 -0700
@@ -198,6 +198,8 @@
 			    ai.status = req->notice;
 			    retrybatchtts = req->tts;
 			}
+			ai.jobinfo = fxStr::format("%u/%u/%u/%u/%u/%u/%u", 
+			    req->totpages, req->ntries, req->ndials, req->totdials, req->maxdials, \
req->tottries, req->maxtries);  if (!ai.record("SEND"))
 			    logError("Error writing SEND accounting record, dest=%s",
 				(const char*) ai.dest);
@@ -387,6 +389,8 @@
     CallID empty_callid;
     ai.callid = empty_callid;
     ri.params.asciiEncode(ai.faxdcs);
+    ai.jobinfo = fxStr::format("%u/%u/%u/%u/%u/%u/%u", 
+	req.totpages, req.ntries, req.ndials, req.totdials, req.maxdials, req.tottries, \
req.maxtries);  if (!ai.record("POLL"))
 	logError("Error writing POLL accounting record, dest=%s",
 	    (const char*) ai.dest);
diff -Nru hylafax.orig/faxd/pageSendApp.c++ hylafax/faxd/pageSendApp.c++
--- hylafax.orig/faxd/pageSendApp.c++	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/faxd/pageSendApp.c++	2006-10-25 12:41:40.238175312 -0700
@@ -165,6 +165,8 @@
 				ai.status = "";
 			    else
 				ai.status = req->notice;
+			    ai.jobinfo = fxStr::format("%u/%u/%u/%u/%u/%u/%u", 
+				req->totpages, req->ntries, req->ndials, req->totdials, req->maxdials, \
req->tottries, req->maxtries);  if (!ai.record("PAGE"))
 				logError("Error writing %s accounting record, dest=%s",
 				    "PAGE", (const char*) ai.dest);
diff -Nru hylafax.orig/man/xferfaxlog.4f hylafax/man/xferfaxlog.4f
--- hylafax.orig/man/xferfaxlog.4f	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/man/xferfaxlog.4f	2006-10-25 12:32:19.972348664 -0700
@@ -46,13 +46,13 @@
 Each record of a facsimile transmission is of the form:
 .sp .5
 .ti +0.5i
-date \s-1SEND\s+1 commid modem jobid jobtag sender ``dest-number'' ``\s-1CSI\s+1'' \
params #pages jobtime conntime ``reason'' \fI<null>\fP \fI<null>\fP ``owner'' ``dcs'' \
+date \s-1SEND\s+1 commid modem jobid jobtag sender ``dest-number'' ``\s-1CSI\s+1'' \
params #pages jobtime conntime ``reason'' \fI<null>\fP \fI<null>\fP ``owner'' ``dcs'' \
                jobinfo
 .sp .5
 .PP
 A facsimile document reception record is of the form:
 .sp .5
 .ti +0.5i
-date \s-1RECV\s+1 commid modem \fI<null>\fP \fI<null>\fP fax ``local-number'' \
``\s-1TSI\s+1'' params #pages jobtime conntime ``reason'' ``CIDName'' ``CIDNumber'' \
``callid'' \fI<null>\fP ``dcs'' +date \s-1RECV\s+1 commid modem \fI<null>\fP \
\fI<null>\fP fax ``local-number'' ``\s-1TSI\s+1'' params #pages jobtime conntime \
                ``reason'' ``CIDName'' ``CIDNumber'' ``callid'' \fI<null>\fP ``dcs'' \
                \fI<null>\fP
 .sp .5
 .PP
 Call records are of the form:
@@ -70,7 +70,7 @@
 An alphanumeric pager request has a record of the form:
 .sp .5
 .ti +0.5i
-date \s-1PAGE\s+1 commid modem jobid jobtag sender ``dest-number'' ``\fI<null>\fP'' \
0 0 jobtime conntime ``reason'' \fI<null>\fP \fI<null>\fP ``owner'' +date \
\s-1PAGE\s+1 commid modem jobid jobtag sender ``dest-number'' ``\fI<null>\fP'' 0 0 \
                jobtime conntime ``reason'' \fI<null>\fP \fI<null>\fP ``owner'' \
                \fI<null>\fP jobinfo
 .sp .5
 .PP
 Expired job records are of the form:
@@ -163,6 +163,9 @@
 .TP 14
 .B dcs
 The T.30 DCS string that was used in the facsimile communication.
+.TP 14
+.B jobinfo
+Other formatted information about the job:  totpages, ntries, ndials, totdials, \
                maxdials, tottries, and maxtries separated by slashes (``/'')
 .PP
 Note that fields may have embedded blanks.
 Session parameters are encoded as a decimal number that contains
diff -Nru hylafax.orig/util/recvstats.sh.in hylafax/util/recvstats.sh.in
--- hylafax.orig/util/recvstats.sh.in	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/util/recvstats.sh.in	2006-10-25 11:01:15.111133848 -0700
@@ -93,6 +93,7 @@
 	$2 == "RECV" && NF == 17 { acct($9, $11, $13, getBR($10), getDF($10), $14, $15, \
$16); }  $2 == "RECV" && NF == 18 { acct($9, $11, $13, getBR($10), getDF($10), $14, \
$15, $16); }  $2 == "RECV" && NF == 19 { acct($9, $11, $13, getBR($10), \
getDFfromDCS($19), $14, $15, $16); } +	$2 == "RECV" && NF == 20 { acct($9, $11, $13, \
getBR($10), getDFfromDCS($19), $14, $15, $16); }  '
     ;;
 -cidname)
@@ -101,6 +102,7 @@
 	$2 == "RECV" && NF == 17 { acct($15, $11, $13, getBR($10), getDF($10), $14, $15, \
$16); }  $2 == "RECV" && NF == 18 { acct($15, $11, $13, getBR($10), getDF($10), $14, \
$15, $16); }  $2 == "RECV" && NF == 19 { acct($15, $11, $13, getBR($10), \
getDFfromDCS($19), $14, $15, $16); } +	$2 == "RECV" && NF == 20 { acct($15, $11, $13, \
getBR($10), getDFfromDCS($19), $14, $15, $16); }  '
     ;;
 -cidnumber)
@@ -109,6 +111,7 @@
 	$2 == "RECV" && NF == 17 { acct($16, $11, $13, getBR($10), getDF($10), $14, $15, \
$16); }  $2 == "RECV" && NF == 18 { acct($16, $11, $13, getBR($10), getDF($10), $14, \
$15, $16); }  $2 == "RECV" && NF == 19 { acct($16, $11, $13, getBR($10), \
getDFfromDCS($19), $14, $15, $16); } +	$2 == "RECV" && NF == 20 { acct($16, $11, $13, \
getBR($10), getDFfromDCS($19), $14, $15, $16); }  '
     ;;
 -dest*)
@@ -121,6 +124,7 @@
 	$2 == "RECV" && NF == 17 { acct($8, $11, $13, getBR($10), getDF($10), $14, $15, \
$16); }  $2 == "RECV" && NF == 18 { acct($8, $11, $13, getBR($10), getDF($10), $14, \
$15, $16); }  $2 == "RECV" && NF == 19 { acct($8, $11, $13, getBR($10), \
getDFfromDCS($19), $14, $15, $16); } +	$2 == "RECV" && NF == 20 { acct($8, $11, $13, \
getBR($10), getDFfromDCS($19), $14, $15, $16); }  '
     ;;
 -speed|-rate)
@@ -134,6 +138,7 @@
 	$2 == "RECV" && NF == 17 { acct(getBR($10), $11, $13, getBR($10), getDF($10), $14, \
$15, $16); }  $2 == "RECV" && NF == 18 { acct(getBR($10), $11, $13, getBR($10), \
getDF($10), $14, $15, $16); }  $2 == "RECV" && NF == 19 { acct(getBR($10), $11, $13, \
getBR($10), getDFfromDCS($19), $14, $15, $16); } +	$2 == "RECV" && NF == 20 { \
acct(getBR($10), $11, $13, getBR($10), getDFfromDCS($19), $14, $15, $16); }  '
     ;;
 -format)
@@ -147,6 +152,7 @@
 	$2 == "RECV" && NF == 17 { acct(getDF($10), $11, $13, getBR($10), getDF($10), $14, \
$15, $16); }  $2 == "RECV" && NF == 18 { acct(getDF($10), $11, $13, getBR($10), \
getDF($10), $14, $15, $16); }  $2 == "RECV" && NF == 19 { acct(getDF($10), $11, $13, \
getBR($10), getDFfromDCS($19), $14, $15, $16); } +	$2 == "RECV" && NF == 20 { \
acct(getDF($10), $11, $13, getBR($10), getDFfromDCS($19), $14, $15, $16); }  '
     ;;
 esac
diff -Nru hylafax.orig/util/xferfaxstats.sh.in hylafax/util/xferfaxstats.sh.in
--- hylafax.orig/util/xferfaxstats.sh.in	2006-10-19 16:43:00.000000000 -0700
+++ hylafax/util/xferfaxstats.sh.in	2006-10-25 11:00:18.358761520 -0700
@@ -91,6 +91,7 @@
 	$2 == "SEND" && NF == 17 { acct($7 " (" $17 ")", $8, $11, $13, getBR($10), \
getDF($10), $14); }  $2 == "SEND" && NF == 18 { acct($7 " (" $18 ")", $8, $11, $13, \
getBR($10), getDF($10), $14); }  $2 == "SEND" && NF == 19 { acct($7 " (" $18 ")", $8, \
$11, $13, getBR($10), getDFfromDCS($19), $14); } +	$2 == "SEND" && NF == 20 { acct($7 \
" (" $18 ")", $8, $11, $13, getBR($10), getDFfromDCS($19), $14); }  '
     KEYTITLE="Sender"
     ;;
@@ -105,6 +106,7 @@
 	$2 == "SEND" && NF == 17 { acct($9, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 18 { acct($9, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 19 { acct($9, $8, $11, $13, getBR($10), getDFfromDCS($19), \
$14); } +	$2 == "SEND" && NF == 20 { acct($9, $8, $11, $13, getBR($10), \
getDFfromDCS($19), $14); }  '
     KEYTITLE="CSI"
     MAPNAMES=no
@@ -120,6 +122,7 @@
 	$2 == "SEND" && NF == 17 { acct($8, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 18 { acct($8, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 19 { acct($8, $8, $11, $13, getBR($10), getDFfromDCS($19), \
$14); } +	$2 == "SEND" && NF == 20 { acct($8, $8, $11, $13, getBR($10), \
getDFfromDCS($19), $14); }  '
     KEYTITLE="Destination"
     MAPNAMES=no
@@ -135,6 +138,7 @@
 	$2 == "SEND" && NF == 17 { acct(getBR($10), $8, $11, $13, getBR($10), getDF($10), \
$14); }  $2 == "SEND" && NF == 18 { acct(getBR($10), $8, $11, $13, getBR($10), \
getDF($10), $14); }  $2 == "SEND" && NF == 19 { acct(getBR($10), $8, $11, $13, \
getBR($10), getDFfromDCS($19), $14); } +	$2 == "SEND" && NF == 20 { acct(getBR($10), \
$8, $11, $13, getBR($10), getDFfromDCS($19), $14); }  '
     KEYTITLE="Speed"
     MAPNAMES=no
@@ -150,6 +154,7 @@
 	$2 == "SEND" && NF == 17 { acct(getDF($10), $8, $11, $13, getBR($10), getDF($10), \
$14); }  $2 == "SEND" && NF == 18 { acct(getDF($10), $8, $11, $13, getBR($10), \
getDF($10), $14); }  $2 == "SEND" && NF == 19 { acct(getDF($10), $8, $11, $13, \
getBR($10), getDFfromDCS($19), $14); } +	$2 == "SEND" && NF == 20 { acct(getDF($10), \
$8, $11, $13, getBR($10), getDFfromDCS($19), $14); }  '
     KEYTITLE="Format"
     MAPNAMES=no
@@ -162,6 +167,7 @@
 	$2 == "SEND" && NF == 17 { acct($6, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 18 { acct($6, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 19 { acct($6, $8, $11, $13, getBR($10), getDFfromDCS($19), \
$14); } +	$2 == "SEND" && NF == 20 { acct($6, $8, $11, $13, getBR($10), \
getDFfromDCS($19), $14); }  '
     KEYTITLE="JobTag"
     MAPNAMES=no
@@ -174,6 +180,7 @@
 	$2 == "SEND" && NF == 17 { acct($4, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 18 { acct($4, $8, $11, $13, getBR($10), getDF($10), $14); }
 	$2 == "SEND" && NF == 19 { acct($4, $8, $11, $13, getBR($10), getDFfromDCS($19), \
$14); } +	$2 == "SEND" && NF == 20 { acct($4, $8, $11, $13, getBR($10), \
getDFfromDCS($19), $14); }  '
     KEYTITLE="Device"
     MAPNAMES=no


____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@ifax.com.*


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic