Log file

The data is logged in the /usr/adm/ras directory. The file name is dependent on each device so each device has a separate log. An example of the rmt1 device file is

The files are in binary format. Each entry has a header followed by the raw Log Sense pages as defined for a particular device.

The first log page is always page 0x00. This page, as defined in the SCSI-2 ANSI specification, contains all the pages that are supported by the device. Page 0x00 is followed by all the pages that are specified in page 0x00. The format of each following page is defined in the SCSI specification and the device manual.

The format of the file is defined by the data structure. The logfile_header is followed by max_log_size (or a fewer number of entries for each file). The log_record_header is followed by a log entry.

The data structure for log recording is
struct logfile_header
    char owner[16];               /* module that created the file */
    time_t when;                  /* time when file created */
    unsigned long count;          /* number of entries in file */
    unsigned long first;          /* first entry number in wrap queue */
    unsigned long max;            /* maximum entries allowed before wrap */
    unsigned long size;           /* size of entry (bytes), entry size is fixed */
struct log_record_header
    time_t when;                  /* time when log entry made */
    ushort type;                  /* log entry type */
      #define LOGDEMOUNT   1      /* demount log entry */
      #define LOGSENSE     2      /* log sense ioctl entry */
      #define LOGOVERFLOW  3      /* log overflow entry */
    char device_type[8];          /* device type that made entry */
    char volid[16];               /* volume ID of entry */
    char serial[12];              /* serial number of device */
The format of the log file is

Each log_record_entry contains multiple log sense pages. The log pages are placed in order one after another. Each log page contains a header followed by the page contents.

The data structure for the header of the log page is
struct log_page_header
    char code;                    /* page code */
    char res;                     /* reserved */
    unsigned short len;           /* length of data in page after header */