RoPkg::Rsync::LogParser(3) a rsync log parser class

SYNOPSIS


#!/usr/bin/perl

use strict;
use warning;
sub main {
my $lp = new RoPkg::Rsync::LogParser( type => 'client' );
$lp->Parse('/tmp/debian-log.txt');
}
main();

Short description

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.

METHODS

new(hash)

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.

Log($raw_log)

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.

Probes(@probes_list)

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($filename)

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).

Files()

In scalar context returns the number of transfered files (filtered by probes list). In list context, returns the list of transfered files.

RealFiles()

In scalar context returns the number of transfered files. In list context, returns the list of transfered files.

Deleted()

In scalar context returns the number of deleted files (filtered by probes list). In list context, returns the list of deleted files.

RealDeleted()

In scalar context returns the number of deleted files. In list context, returns the list of deleted files.

Speed()

Returns the speed (as reported by rsync [in bytes/sec]) of the transfer.

Size()

Returns the size of the synced content.

TransfData()

Returns the total number of bytes transfered during the sync session

Symlinks()

In scalar context returns the number of symlinks (filtered by probes list). In list context, returns the list of symlinks.

RealSymlinks()

In scalar context returns the number of symlinks. In list context, returns the list of symlinks.

PREREQUISITES

RoPkg::Utils requires perl 5.008 or later and RoPkg::Exceptions class. From CPAN, 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).

AUTHOR

Subredu Manuel <[email protected]>

LICENSE

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 LICENSE file contains the full text of the license.