diff options
author | Wayne Davison <wayned@samba.org> | 2005-02-19 19:36:54 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2005-02-19 19:36:54 +0000 |
commit | aa57d14ae7d7439245c5f8b28bd9fd01889a8eeb (patch) | |
tree | b9138e25b551689a7175995b4f8f7fb21fde7342 /support/rsyncstats | |
parent | 3c54d8a3ad9101fdbde95b7c44e78d4bc6afbbbb (diff) | |
download | rsync-aa57d14ae7d7439245c5f8b28bd9fd01889a8eeb.tar.gz |
We now use a regular expression to parse the (restored to its previous
version) default logfile format. Added parsing for a version of the
default logfile format where %o has been replaced with %i.
Diffstat (limited to 'support/rsyncstats')
-rwxr-xr-x | support/rsyncstats | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/support/rsyncstats b/support/rsyncstats index f172f60e..b8cd00ee 100755 --- a/support/rsyncstats +++ b/support/rsyncstats @@ -1,9 +1,11 @@ #!/usr/bin/perl # # This script parses the default logfile format produced by rsync when running -# as a daemon with transfer logging enabled. It is derived from the xferstats -# script that comes with wuftpd. See the usage message at the bottom for the -# options it takes. +# as a daemon with transfer logging enabled. It also parses a slightly tweaked +# version of the default format where %o has been replaced with %i. +# +# This script is derived from the xferstats script that comes with wuftpd. See +# the usage message at the bottom for the options it takes. # # Andrew Tridgell, October 1998 @@ -50,10 +52,16 @@ if ($only_section) { line: while (<LOG>) { - ($day,$time,$pid,$op,$host,$ip,$module,$user,$bytes,$file) = split(' ', $_, 10); - next unless defined $file; + next unless ($day,$time,$op,$host,$module,$file,$bytes) + = m#^ (\d+/\d\d/\d\d)\s+(\d\d:\d\d:\d\d)\s+\[\d+\]\s+(send|recv|[<>]f\S+)\s+ + (\S+)\s+\[\d+\.\d+\.\d+\.\d+\]\s+(\S+)\s+\(\S*\)\s+(.*)\s+(\d+) $ #x; - next if $op ne 'send' && $op ne 'recv'; + # TODO actually divide the data by into send/recv categories + if ($op =~ /^>/) { + $op = 'send'; + } elsif ($op =~ /^</) { + $op = 'recv'; + } $daytime = $day; $hour = substr($time,0,2); |