sshaw > NcFTPd-Log-Parse-0.001 > NcFTPd::Log::Parse::Session

Download:
NcFTPd-Log-Parse-0.001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

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.

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

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.

syntax highlighting: