INN commit: trunk (5 files)

INN Commit Russ_Allbery at isc.org
Mon Aug 6 09:13:02 UTC 2007


    Date: Monday, August 6, 2007 @ 02:13:02
  Author: iulius
Revision: 7633

Add a config directive (logstats) that makes innd send its incoming
stats to syslog, in the same format as the channel closing message
(and including a 'ME' line with the totals), every <status> seconds.

It is indeed easier to process after than the inn_status.html where
the prettified sizes lack precision.

Thanks to Fred Senault for the patch.

Modified:
  trunk/doc/pod/inn.conf.pod
  trunk/include/inn/innconf.h
  trunk/innd/status.c
  trunk/lib/innconf.c
  trunk/samples/inn.conf.in

-----------------------+
 doc/pod/inn.conf.pod  |    7 +++++++
 include/inn/innconf.h |    1 +
 innd/status.c         |   22 +++++++++++++++++++++-
 lib/innconf.c         |    1 +
 samples/inn.conf.in   |    1 +
 5 files changed, 31 insertions(+), 1 deletion(-)

Modified: doc/pod/inn.conf.pod
===================================================================
--- doc/pod/inn.conf.pod	2007-08-05 13:39:50 UTC (rev 7632)
+++ doc/pod/inn.conf.pod	2007-08-06 09:13:02 UTC (rev 7633)
@@ -993,6 +993,13 @@
 statistics and can be used by newsrequeue(8).  This is a boolean value and
 the default is true.
 
+=item I<logstatus>
+
+Whether B<innd> should write a shortened version of its status report
+to syslog every I<status> seconds.  This is a boolean value and the default
+is false.  If set to true, see the I<status> parameter for more details
+on how to enable status reporting.
+
 =item I<nnrpdoverstats>
 
 Whether nnrpd overview statistics should be logged via syslog.  This can

Modified: include/inn/innconf.h
===================================================================
--- include/inn/innconf.h	2007-08-05 13:39:50 UTC (rev 7632)
+++ include/inn/innconf.h	2007-08-06 09:13:02 UTC (rev 7633)
@@ -135,6 +135,7 @@
     long logcycles;             /* How many old logs scanlogs should keep */
     bool logipaddr;             /* Log by host IP address? */
     bool logsitename;           /* Log outgoing site names? */
+    bool logstatus;             /* Send a status report to syslog? */
     bool nnrpdoverstats;        /* Log overview statistics? */
     long nntpactsync;           /* Checkpoint log after this many articles */
     bool nntplinklog;           /* Put storage token into the log? */

Modified: innd/status.c
===================================================================
--- innd/status.c	2007-08-05 13:39:50 UTC (rev 7632)
+++ innd/status.c	2007-08-06 09:13:02 UTC (rev 7633)
@@ -291,7 +291,16 @@
   fprintf (F, "   rejected size: %-7s    %%rejected size: %.1f%%\n",
 	   PrettySize(RejectSize, str), (float) RejectSize / size * 100);
   fputc ('\n', F) ;
-  
+
+  if(innconf->logstatus) {
+    notice ("%s status seconds %ld accepted %ld "
+            "refused %ld rejected %ld duplicate %ld "
+            "accepted size %.0f duplicate size %.0f rejected size %.0f\n",
+                "ME", (long) seconds, accepted,
+                refused, rejected, duplicate,
+                size, DuplicateSize, RejectSize);
+  }
+
   /* Incoming Feeds */
   for (status = head ; status != NULL ;) {
     fprintf (F, "%s\n",                      status->name);
@@ -335,6 +344,16 @@
 	     NNTP_FAIL_CHECK_REFUSE, status->Check_cybercan);
     }
     fputc ('\n', F) ;
+
+    if(innconf->logstatus) {
+      notice ("%s status seconds %ld accepted %ld "
+              "refused %ld rejected %ld duplicate %ld "
+              "accepted size %.0f duplicate size %.0f rejected size %.0f\n",
+                  status->name, (long) status->seconds, status->accepted,
+                  status->refused, status->rejected, status->Duplicate,
+                  status->Size, status->DuplicateSize, status->RejectSize);
+    }
+
     tmp = status->next;
     free(status);
     status = tmp;
@@ -346,6 +365,7 @@
 #endif /* defined(HTML_STATUS) */
 
   Fclose(F);
+  free(path);
 }
 
 void

Modified: lib/innconf.c
===================================================================
--- lib/innconf.c	2007-08-05 13:39:50 UTC (rev 7632)
+++ lib/innconf.c	2007-08-06 09:13:02 UTC (rev 7633)
@@ -156,6 +156,7 @@
     { K(logcancelcomm),         BOOL    (false) },
     { K(logipaddr),             BOOL    (true) },
     { K(logsitename),           BOOL    (true) },
+    { K(logstatus),             BOOL    (false) },
     { K(maxartsize),            NUMBER  (1000000) },
     { K(maxconnections),        NUMBER  (50) },
     { K(mergetogroups),         BOOL    (false) },

Modified: samples/inn.conf.in
===================================================================
--- samples/inn.conf.in	2007-08-05 13:39:50 UTC (rev 7632)
+++ samples/inn.conf.in	2007-08-06 09:13:02 UTC (rev 7633)
@@ -140,6 +140,7 @@
 logcycles:              3
 logipaddr:              true
 logsitename:            true
+logstatus:              false
 nnrpdoverstats:         false
 nntpactsync:            200
 nntplinklog:            false



More information about the inn-committers mailing list