INN commit: trunk/frontends (cnfsstat.in)

INN Commit rra at isc.org
Sat Aug 8 17:18:24 UTC 2015


    Date: Saturday, August 8, 2015 @ 10:18:23
  Author: iulius
Revision: 9927

cnfsstat:  Improve logging

Do not write stats until the CNFS buffer has been initialized.

Also do not write double quotes twice around group patterns.

Modified:
  trunk/frontends/cnfsstat.in

-------------+
 cnfsstat.in |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Modified: cnfsstat.in
===================================================================
--- cnfsstat.in	2015-08-08 17:08:02 UTC (rev 9926)
+++ cnfsstat.in	2015-08-08 17:18:23 UTC (rev 9927)
@@ -159,6 +159,8 @@
             } else {
                 ($gr, $cl, $min, $max) = ('', $oclass, 0, 0);
             }
+            # Remove leading and trailing double quotes, if present.
+            $gr =~ s/"?([^"]*)"?/$1/g;
 	    if ($use_syslog) {
 		if ($min || $max) {
 		    $logline = sprintf("Class %s for groups matching \"%s\" article size min/max: %d/%d", $oclass, $gr, $min, $max);
@@ -196,6 +198,8 @@
 
     foreach my $c (@storsort) {
 	($gr, $cl, $min, $max) = split(/:/, $stor{$c});
+        # Remove leading and trailing double quotes, if present.
+        $gr =~ s/"?([^"]*)"?/$1/g;
 	if ($use_syslog) {
 	    if ($min || $max) {
 		$logline = sprintf("Class %s for groups matching \"%s\" article size min/max: %d/%d", $c, $gr, $min, $max);
@@ -330,10 +334,12 @@
     if ($use_syslog) {
 	($name) = split(/\s/, $name);
 	$name =~ s/\0//g;
+	# Log only if the buffer is initialized (cyclenum is not -1).
 	syslog ('notice', '%s Buffer %s, len: %.2f  Mbytes, used: %.2f Mbytes (%4.1f%%) %3d cycles',
 		$logline, $name, Math::BigFloat->new($len) / (1024 * 1024),
 		Math::BigFloat->new($free) / (1024 * 1024),
-		100 * Math::BigFloat->new($free) / Math::BigFloat->new($len), $cyclenum);
+		100 * Math::BigFloat->new($free) / Math::BigFloat->new($len),
+		$cyclenum) if $cyclenum >= 0;
 	return 0;
     }
 



More information about the inn-committers mailing list