NAME
NcFTPd::Log::Parse::Xfer - parse NcFTPd xfer logs
SYNOPSIS
use NcFTPd::Log::Parse::Xfer;
$parser = NcFTPd::Log::Parse::Xfer->new('xfer.20100101');
while($line = $parser->next) {
if($line->{operation} eq 'S') {
print 'Upload';
$line->{pathname};
$line->{size};
# ...
}
}
# Check for an error, otherwise it was EOF
if($parser->error) {
die 'Parsing failed: ' . $parser->error;
}
DESCRIPTION
This class is part of the NcFTPd::Log::Parse package. Refer to its documentation for a detailed overview of how this and the other parsers work.
Only NcFTPd::Log::Parse::Xfer specific features are described here.
XFER LOG ENTRIES
Parsed Xfer log entries are returned as hash references whose keys are dependent on the entry's operation. Operations are described below.
Logs created by older versions of NcFTPd may contain less fields than listed here. In these cases the missing field(s) will have a value of undef.
Only the non-obvious fields are described.
chmod
chmod entries have an operation code of C
timeDate & time the entry occured
processNcFTPd process ID
operationOperation code for the type of activity this entry represents, set to
CpathnamemodeUnix style permissions set on
pathnameby this operationreserved1NcFTPd reserved field (empty string)
reserved2NcFTPd reserved field (empty string)
useremailAnonymous user's password, NcFTPd refers to this as email
hostsession_id
delete
delete entries have an operation code of D
timeDate & time the entry occured
processNcFTPd process ID
operationOperation code for the type of activity this entry represents, set to
Dpathnamereserved1NcFTPd reserved field (empty string)
reserved2NcFTPd reserved field (empty string)
reserved3NcFTPd reserved field (empty string)
useremailAnonymous user's password, NcFTPd refers to this as email
hostsession_id
link
link entries have an operation code of L
timeDate & time the entry occured
processNcFTPd process ID
operationOperation code for the type of activity this entry represents, set to
LsourcePath of the file used to create the link
reserved1NcFTPd reserved field, always set to
todestinationPath of the link
reserved2useremailAnonymous user's password, NcFTPd refers to this as email
hostsession_id
listing
Directory listing entries have an operation code of T
timeDate & time the entry occured
processNcFTPd process ID
operationOperation code for the type of activity this entry represents, set to
TpathnamestatusSet to one of the following:
OK ABOR INCOMPLETE PERM NOENT ERRORpatternrecursionSet to
RECURSIVEif this was a recursive listing, an empty string otherwiseuseremailAnonymous user's password, NcFTPd refers to this as email
hostsession_id
mkdir
Mkdir entries have an operation code of M. The fields are the same as the delete operation's.
rename
Rename entries have an operation code of N. The fields are the same as the link operation's.
retrieve
Retrieve entries (downloads) have an operation code of R. The fields are the same as the store operation's.
store
Store entries (uploads) have an operation code of S
timeDate & time the entry occured
processNcFTPd process ID
operationOperation code for the type of activity this entry represents, set to
SpathnamesizeThe number of bytes transfered
durtaionLength of the operation in seconds
rateKbps transfer rate
useremailAnonymous user's password, NcFTPd refers to this as email
hostsuffixNcFTPd can create archives on the fly. If one was created, this field contains the archive's extention.
statusSet to one of the following:
OK ABOR INCOMPLETE PERM NOENT ERRORSee the NcFTPd docs for more info: http://ncftpd.com/ncftpd/doc/xferlog.html#status
typeBinary or ASCII transfer,
AorInotesA string of codes providing additional details about the operation. The field can be expanded into something descriptive.
start_of_transferUnix timestamp denoting the start of the transfer
session_idstarting_sizeSize of the file when the transfer started,
-1if unknownstarting_offsetFile offset where the transfer began,
-1if unknown
METHODS
See NcFTPd::Log::Parse for the full documentation.
new
Create a parser capable of parsing the specified xfer log:
$parser = NcFTPd::Log::Parse::Xfer->new($file, %options)
Returns
A parser capable of parsing the specified xfer log.
Arguments
%options
expand => 1|0expand => [ 'field1', 'field2', ... ]Currently only the
operationandnotesfields can be expanded.1will expand all fields0, the default, will not expand any.An entry's
operationfield is a single character denoting type of log entry (see "XFER LOG ENTRIES"). Useexpandto replace this with a meaningful one word description:# Without expand print "Op: $entry->{operation}" Op: T # With expand print "Op: $entry->{operation}" Op: listingAn entry's
notesfield can contain a string of multiple character codes. These codes can provide additional details about the operation. Useexpandto replace this string of codes with an array reference of meaningfull descriptions:# Without expand print "Notes: $entry->{notes}" Notes: SfPs # With expand print 'Notes: ', join(', ', @{$entry->{notes}}) Notes: Used sendfile, PASV connectionfilter => sub { ... }See
filter's documentation under "new" in NcFTPd::Log::Parse
Errors
If a parser cannot be created an error will be raised.
SEE ALSO
NcFTPd::Log::Parse, NcFTPd::Log::Parse::Session, NcFTPd::Log::Parse::Misc and the NcFTPd log file documentation http://ncftpd.com/ncftpd/doc/misc
AUTHOR
Skye Shaw <sshaw AT lucas.cis.temple.edu>
COPYRIGHT
Copyright (C) 2011 Skye Shaw
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.