NAME
NcFTPd::Log::Parse::Session - parse NcFTPd session logs
SYNOPSIS
use NcFTPd::Log::Parse::Session;
$parser = NcFTPd::Log::Parse::Session->new('sess.20100101');
while($line = $parser->next) {
$line->{user};
$line->{successful_downloads};
$line->{failed_uploads};
# ...
}
}
# 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::Session
specific features are described here.
SESSION LOG ENTRIES
Unless noted, fields in a session log contain summaries of a user's activity (or lack of activity). Only the non-obvious fields are described here.
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
.
time
Date & time the connection was closed
process
NcFTPd process ID
user
Username provided for this session. Could contain the value
REFUSED
orDENIED
. See the NcFTPd docs for more details.email
host
session_time
The total amount of time the user was logged in, given in seconds
time_between_commands
Given in seconds
bytes_retrieved
bytes_stored
number_of_commands
Number of commands the user sent
retrieves
stores
chdirs
nlists
lists
types
Number of times the user changed the transfer type (i.e binary or ASCII)
port_pasv
Number of
PORT
andPASV
commandspwd
size
mdtm
Number of file modification time requests
site
logins
Successful logins
failed_data_connections
last_transfer_result
The result of the last transfer for this session, 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
successful_downloads
failed_downloads
successful_uploads
failed_uploads
successful_listings
failed_listings
close_code
The reason the connection was closed, See "CLOSE CODES".
This field can be expand to something more descriptive. See
expand
.session_id
CLOSE CODES
Integers describing why the connection was closed. Refer to the NcFTPd documentation: http://ncftpd.com/ncftpd/doc/sesslog.html#CloseCodes
METHODS
See NcFTPd::Log::Parse for the full documentation.
new
Create a parser capable of parsing the specified session log:
$parser = NcFTPd::Log::Parse::Session->new($file, %options)
Returns
A parser capable of parsing the specified session log.
Arguments
%options
expand => 1|0
expand => [ 'field1', 'field2', ... ]
Currently only the close_code
field can be expanded. 1
will expand all fields 0
, the default, will not expand any.
By default close_code
contains an integer value denoting the reason the connection was closed. Use expand
to replace these integers with a meaningful description:
# Without expand
print "Closed because: $entry->{close_code}"
# Closed because: 2
# With expand
print "Closed because: $entry->{close_code}"
# Closed because: Miscellaneous error
Errors
If a parser cannot be created an error will be raised.
SEE ALSO
NcFTPd::Log::Parse, NcFTPd::Log::Parse::Xfer, 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.