[pve-devel] r5744 - in pve-access-control/trunk: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Mar 23 08:27:57 CET 2011


Author: dietmar
Date: 2011-03-23 08:27:57 +0100 (Wed, 23 Mar 2011)
New Revision: 5744

Modified:
   pve-access-control/trunk/ChangeLog
   pve-access-control/trunk/PVE/RPCEnvironment.pm
Log:
	* PVE/RPCEnvironment.pm (active_workers): simple log rotation when
	file is bigger that 50KB



Modified: pve-access-control/trunk/ChangeLog
===================================================================
--- pve-access-control/trunk/ChangeLog	2011-03-23 07:07:26 UTC (rev 5743)
+++ pve-access-control/trunk/ChangeLog	2011-03-23 07:27:57 UTC (rev 5744)
@@ -1,3 +1,8 @@
+2011-03-23  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/RPCEnvironment.pm (active_workers): simple log rotation when
+	file is bigger that 50KB
+
 2011-03-22  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/RPCEnvironment.pm (set_result_count): a way to set the total

Modified: pve-access-control/trunk/PVE/RPCEnvironment.pm
===================================================================
--- pve-access-control/trunk/PVE/RPCEnvironment.pm	2011-03-23 07:07:26 UTC (rev 5743)
+++ pve-access-control/trunk/PVE/RPCEnvironment.pm	2011-03-23 07:27:57 UTC (rev 5744)
@@ -382,11 +382,13 @@
 	}
 
 	if ($archive) {
+	    my $size = 0;
+	    my $filename = "/var/log/pve/tasks/index";
 	    eval {
-		my $filename = "/var/log/pve/tasks/index";
 		my $fh = IO::File->new($filename, '>>', 0644) ||
 		    die "unable to open file '$filename' - $!\n";
 		PVE::Tools::safe_print($filename, $fh, $archive);
+		$size = -s $fh;
 		close($fh) ||
 		    die "unable to close file '$filename' - $!\n";
 	    };
@@ -397,6 +399,10 @@
 		    $task->{saved} = 0;
 		}
 	    }
+	    my $maxsize = 50000; # about 1000 entries
+	    if ($size > $maxsize) {
+		rename($filename, "$filename.1");
+	    }
 	}
 
 	# we try to reduce the amount of data



More information about the pve-devel mailing list