A rsync log parser class
#!/usr/bin/perl
use strict; use warning;
sub main { my $lp = new RoPkg::Rsync::LogParser( type => 'client' );
$lp->Parse('/tmp/debian-log.txt'); }
main();
RoPkg::Rsync::LogParser is a class used to parse (for the moment) client side rsync logs. Using this class you can extract the transfered files, symlinks created, directories, total number of files, transfered bytes, speed of transfer etc. LogParser support list filter trough probes (used by many projects to verify the mirrors). The primary use of this class is inside Simba, but can be used without problems in any other project who needs a rsync client log parser.
\$1
Constructor of the class. When creating a new class instance you must provide the type of log: client or server . For the moment only the client parsing routines are defined. Get/Set the raw rsync log. With no parameters, the get behaviour is selected. If a parameter is present (and valid) the method acts as a Set method. Get/Set the raw probes list. If no parameter is present, the method returns the number of probes defined (0 if none). If a list of probes is given, the list is added to the existing list of probes. Parse a rsync client log. If no filename is specified, the method parses the log previsiously set with Log() method. Please take extra care with the filename. If it does not exists, or is not a file a exception will be raised (Param::Wrong and File::Open). In scalar context returns the number of transfered files (filtered by probes list). In list context, returns the list of transfered files. In scalar context returns the number of transfered files. In list context, returns the list of transfered files. In scalar context returns the number of deleted files (filtered by probes list). In list context, returns the list of deleted files. In scalar context returns the number of deleted files. In list context, returns the list of deleted files. Returns the speed (as reported by rsync [in bytes/sec]) of the transfer. Returns the size of the synced content. Returns the total number of bytes transfered during the sync session In scalar context returns the number of symlinks (filtered by probes list). In list context, returns the list of symlinks. In scalar context returns the number of symlinks. In list context, returns the list of symlinks.
RoPkg::Utils requires perl 5.008 or later and RoPkg::Exceptions class. From \s-1CPAN\s0, you need the Scalar::Util module. At build time Test::More is required for tests (if you don't plan to use the tests ignore this dependency).
RoPkg::Rsync::Node RoPkg::Rsync::ConfFile RoPkg::Exceptions
Subredu Manuel <[email protected]>
Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The \s-1LICENSE\s0 file contains the full text of the license.