Summary: Isode provides a number of APIs which allow integrators and product developers to build components that access the Isode Messaging server products or other products supporting the same protocols.
Log file viewing and monitoring

Macros

#define SOM_FACILITY_LOGFILE   1
 

Typedefs

typedef void SOMLogfileCallback(struct SOMSession *session, void *ophandle, void *clientdata, int status, const char *opdata, size_t opdatalen)
 Prototype for callback for logfile operation completion. More...
 

Functions

int SOMLogfileSetCallback (struct SOMSession *session, SOMLogfileCallback *callback, SOMLogfileCallback **oldvalue)
 Set the logfile callback function for this session. More...
 
int SOMLogfileMonitor (struct SOMSession *session, const char *filepattern, const char *searchpattern, int interval, void *ophandle, int async)
 Set Logfile monitoring. More...
 
int SOMLogfileView (struct SOMSession *session, const char *filepattern, const char *searchpattern, const char *startdatetime, const char *enddatetime, int numlines, void *ophandle, int async)
 View lines from log files. More...
 
int SOMLogfileList (struct SOMSession *session, const char *filepattern, void *ophandle, int async)
 List log files. More...
 

Detailed Description

Description of the function calls for viewing and monitoring log files.

Note: all log file operations return their results via the callback.

Macro Definition Documentation

#define SOM_FACILITY_LOGFILE   1

Mask requesting LOGFILE facility

Definition at line 28 of file logfile.h.

Typedef Documentation

typedef void SOMLogfileCallback(struct SOMSession *session, void *ophandle, void *clientdata, int status, const char *opdata, size_t opdatalen)

Prototype for callback for logfile operation completion.

Parameters
session[in] Pointer to address of session object
ophandle[in] Data associated with operation
clientdata[in] Data associated with session
status[in] Status for the operation
opdata[in] Data returned by operation
opdatalen[in] Length of data returned by operation
Returns
no return value

The structure of the data returned depends upon the operation.

The operation handle value is NULL for log file monitoring data, as this is not associated with a specific operation.

Definition at line 46 of file logfile.h.

Function Documentation

int SOMLogfileSetCallback ( struct SOMSession session,
SOMLogfileCallback callback,
SOMLogfileCallback **  oldvalue 
)

Set the logfile callback function for this session.

Parameters
session[in] Pointer to address of session object
callback[in] Address of callback function
oldvalue[out] Pointer to location for previous value of callback function
Returns
zero on success; non-zero on error

callback may be NULL to clear the callback function oldvalue may be NULL, in which case the previous value is not returned

int SOMLogfileMonitor ( struct SOMSession session,
const char *  filepattern,
const char *  searchpattern,
int  interval,
void *  ophandle,
int  async 
)

Set Logfile monitoring.

Parameters
session[in] Pointer to address of session object
filepattern[in] Pattern to match files to be monitored
searchpattern[in] Pattern to search for in files
interval[in] Time interval in seconds to check files
ophandle[in] Value passed to callback
async[in] Operation is asynchronous if TRUE
Returns
zero on success; non-zero on error

Sets up the monitoring. The file pattern can be a set of alternates. If the filepattern is NULL, monitoring stops.

If the searchpattern is set, then this is applied at the server end to reduce the traffic.

If the operation is async, then the Logfile callback is called with the operation handle on completion of the operation (successful or not).

The actual file monitoring data is sent unprompted, and results in the callback being called with a NULL ophandle. The data is a string being lines formatted as:

 \<filename\>:\<data\>\\n
int SOMLogfileView ( struct SOMSession session,
const char *  filepattern,
const char *  searchpattern,
const char *  startdatetime,
const char *  enddatetime,
int  numlines,
void *  ophandle,
int  async 
)

View lines from log files.

Parameters
session[in] Pointer to address of session object
filepattern[in] Pattern to match files to be viewed.
searchpattern[in] Pattern to search for in files.
startdatetime[in] Start date/time for search
enddatetime[in] End date/time for search
numlines[in] Number of lines to be returned
ophandle[in] Value passed to callback
async[in] Operation is asynchronous if TRUE
Returns
zero on success; non-zero on error

Search log files specified by the pattern.

If the searchpattern is set, only lines matching the pattern are returned. If the start/end times are set, only messages after/before these times are returned. The start/end times should be specified as a UTC time string without timezone, e.g. YYYYMMDDHHMMSS.

If numlines is not zero, this limits the number of lines returned. A negative number means the first N lines, a positive number means the last N lines. If zero is specified, a server limit may be applied, which will return the last N lines up to some limit.

Data is returned via the callback function, in the same format as the monitoring.

int SOMLogfileList ( struct SOMSession session,
const char *  filepattern,
void *  ophandle,
int  async 
)

List log files.

Parameters
session[in] Pointer to address of session object
filepattern[in] Pattern to match files to be listed
ophandle[in] Value passed to callback
async[in] Operation is asynchronous if TRUE
Returns
zero on success; non-zero on error

Data is returned using the callback, and consists of lines containing the names of matching files.