PerlWare::Audit
PerlWare::Audit is a class designed to retrieve audit data from both volume
and container audit files.
Each record is returned as values separated by <tab> characters
so direct printing without formatting is possible.
Audit records consist of a fixed set of attributes plus additional
data for some events.
Fixed data
Volume audit record |
Seconds since Jan. 1. 1970 |
Event |
connectionID |
Username |
Status |
Container audit record |
Seconds since Jan. 1. 1970 |
Event |
userID |
Username |
Status |
Seconds since Jan. 1. 1970 can be used directly in perl builtin functions
such as localtime().
Event is the event that triggered the audit. Please refer to your Netware
documentation for a explaination
for each event.
connectionID is the connection number that triggered the audit event.
Status should be considered as Success (0) or Failure (Non zero).
Note:
If you have set a audit password on your audit logs you may face problems
reading the audit files. Open()
would return a error code.
The new approach by Novell is to read the rights you have to the audit
object in NDS and use
the rights found (No rights, Read or Read/Write) to grant access to
the audit files regardless if a password is set
or not. You must login with Read rights to the audit object to read
its content. The NDSContext object
have support for login to NDS.
You probably want to follow this path:
new -> Open -> GetFileList -> OpenRecordFile -> ReadRecords -> CloseRecordFile
-> Close.
Method Index:
Methods
These metods are present in the module PerlWare::Audit
new
Creates a new PerlWare::Audit object which can be used to get the Audit
data.
The new method takes two parameters:
$Object :
a PerlWare::NWServer object if you are doing volume auditing or
a PerlWare or PerlWare::NDSContext object if you want container auditing.
$Name:
The name of the volume or container which auditing is enable for.
Returns a PerlWare::Audit object on success, undef on failure.
Examples:
$AudObj = new PerlWare::Audit($Object, $Name);
$AudObj = new PerlWare::Audit($SrvObject, "SYS");
$AudObj = new PerlWare::Audit($PerlWareObject, "stud.ahs.hist");
Close
Close the audit session with the Netware server.
You do not need to close the session because this is done automaticly
when the PerlWare::Audit object is destroyed.
Returns 0 on success, Netware error code on failure.
Example:
$ErrCode = $AudObj->Close();
CloseRecordFile
Close a open recordfile.
Returns 0 on success, Netware error code on failure.
Example:
$ErrCode = $AudObj->CloseRecordFile();
GetFileList
Returns the list of old audit files for the audit object. These files
are returned as an array. There can be up to
16 files in this array or none.
When calling OpenRecordFile() you should use the same index as in this
array to bind to one file.
The array is constructed of "filecreateDateTime"<SPACE>"filSize"
records.
In addition to the indexes used in this array you have a active file
which is refered to with index -1 when calling OpenRecordFile().
Returns undef on failure or if there only are an active file, in which
case you can use LastErr() to get the netware error-code.
Example:
@FileList = $AudObj->GetFileList();
IsInit
Check if the PerlWare::Audit abject is initialized as it should.
Returns 1 if initalized, 0 for failure.
Example:
$IsOK = $AudObj->IsInit();
Open
Opens a handle for the PerlWare::Audit object to use with the auditing
system.
Returns 0 on success, Netware error code on failure.
Examples:
$ErrCode = $AudObj->Open();
OpenRecordFile
Open a audit file for reading. The $index parameter is the same as
the index in array retrieved with GetFileList().
It's also possible to use -1 as index in which case the active audit
file is opened for reading.
Returns 0 on success, Netware error code on failure.
Example:
$ErrCode = $AudObj->OpenRecordFile($index); # Some old audit
file.
$ErrCode = $AudObj->OpenRecordFile(-1); # The active auditfile.
ReadRecords
ReadRecords() return all records from the opened auditfile. Each event
is returned as a single line. Each value on this line is separated with
'\t'.
See the fixed data for values always present and
your Netware docs for additional data.
Returns undef on failure, in which case you can use LastErr() to get
the netware error-code.
Example:
@Records = $AudObj->ReadRecords();
SEE ALSO
the NDSContext class
the Misc help file
the Buf_T class
the PerlWare help file
the NWServer class
http://www.ahs.hist.no/distr/PerlWare/
COPYRIGHT
Copyright (c) Steinar Kleven 1997.
All rights reserved.