Audit Trail Mechanism

1 Configuration
2 Installation
3 Function Reference
4 Notes and Caveats
5 Audit Trail Format

1 Configuration

ISAUDIT settings in isconfig.h

   0 - no audit functionality
   1 - audit writes, updates and deletes
   2 - audit writes only
   3 - audit deletes only
   4 - audit updates only
   5 - audit writes and deletes
   6 - audit writes and updates
   7 - audit deletes and updates

2 Installation

Audit trail support is activated by setting ISAUDIT to a value of 1 in isconfig.h before compiling the library.

3 Function Reference

int isAudit( IsFile * isfd, char * pad, int mode );

4 Notes and Caveats

The audit trail is essentially a more streamlined alternative to the full featured transaction processing option. Only updates to the file are tracked, and the processing overhead is less. While there is no harm in having both options active in your library at the same time, it would be somewhat redundant to have both in use on the same file.

Two things to be aware of:

The audit trail impacts the overall efficiency of the library - if you do not plan to use it, you would probably be best advised to leave it inactive.

Once a file has been designated as having an audit trail, and even if the trail is currently in the inactive state (AUDSTOP'ed), updates to the file will be slower because, by cisam™ design, the protocol requires that the status be checked each time the file is updated by another process. This is only the case when the file is open by multiple processes.

This information presented mostly for reference - the actual impact is reportedly quite minimal under all platforms tested.

5 Audit Trail Format

The format of the audit trail consists of a header record followed by a data image, repeated sequentially. In the case of variable length files, an additional 2 bytes are included to give the record length. all values are stored in machine independent (ldint/ldlong) format.

struct audhead                          /* audit record header format */
  {
  char au_type[2];                      /* record type (aa/dd/rr/ww) */
  char au_time[4];                      /* date and time */
  char au_procid[2];                    /* process id */
  char au_userid[2];                    /* user id */
  char au_recnum[4];                    /* record number */
  char au_reclen[2];                    /* record length if variable */
  };

#define AUDHEADSIZE     14              /* audit header length */
#define VAUDHEADSIZE    16              /* if variable length */

type codes are translated as follows:

aa - record added to file
dd - record deleted from file
rr - record image before rewriting
ww - record image after rewriting