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
time
Date & time the entry occured
process
NcFTPd process ID
operation
Operation code for the type of activity this entry represents, set to
C
pathname
mode
Unix style permissions set on
pathname
by this operationreserved1
NcFTPd reserved field (empty string)
reserved2
NcFTPd reserved field (empty string)
user
email
Anonymous user's password, NcFTPd refers to this as email
host
session_id
delete
delete entries have an operation
code of D
time
Date & time the entry occured
process
NcFTPd process ID
operation
Operation code for the type of activity this entry represents, set to
D
pathname
reserved1
NcFTPd reserved field (empty string)
reserved2
NcFTPd reserved field (empty string)
reserved3
NcFTPd reserved field (empty string)
user
email
Anonymous user's password, NcFTPd refers to this as email
host
session_id
link
link entries have an operation
code of L
time
Date & time the entry occured
process
NcFTPd process ID
operation
Operation code for the type of activity this entry represents, set to
L
source
Path of the file used to create the link
reserved1
NcFTPd reserved field, always set to
to
destination
Path of the link
reserved2
user
email
Anonymous user's password, NcFTPd refers to this as email
host
session_id
listing
Directory listing entries have an operation
code of T
time
Date & time the entry occured
process
NcFTPd process ID
operation
Operation code for the type of activity this entry represents, set to
T
pathname
status
Set to one of the following:
OK ABOR INCOMPLETE PERM NOENT ERROR
pattern
recursion
Set to
RECURSIVE
if this was a recursive listing, an empty string otherwiseuser
email
Anonymous user's password, NcFTPd refers to this as email
host
session_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
time
Date & time the entry occured
process
NcFTPd process ID
operation
Operation code for the type of activity this entry represents, set to
S
pathname
size
The number of bytes transfered
durtaion
Length of the operation in seconds
rate
Kbps transfer rate
user
email
Anonymous user's password, NcFTPd refers to this as email
host
suffix
NcFTPd can create archives on the fly. If one was created, this field contains the archive's extention.
status
Set to one of the following:
OK ABOR INCOMPLETE PERM NOENT ERROR
See the NcFTPd docs for more info: http://ncftpd.com/ncftpd/doc/xferlog.html#status
type
Binary or ASCII transfer,
A
orI
notes
A string of codes providing additional details about the operation. The field can be expanded into something descriptive.
start_of_transfer
Unix timestamp denoting the start of the transfer
session_id
starting_size
Size of the file when the transfer started,
-1
if unknownstarting_offset
File offset where the transfer began,
-1
if 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|0
expand => [ 'field1', 'field2', ... ]
Currently only the
operation
andnotes
fields can be expanded.1
will expand all fields0
, the default, will not expand any.An entry's
operation
field is a single character denoting type of log entry (see "XFER LOG ENTRIES"). Useexpand
to replace this with a meaningful one word description:# Without expand print "Op: $entry->{operation}" Op: T # With expand print "Op: $entry->{operation}" Op: listing
An entry's
notes
field can contain a string of multiple character codes. These codes can provide additional details about the operation. Useexpand
to 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 connection
filter => 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.