pGina MySQL Logger Plugin Documentation

How it Works

The MySQL Logger plugin logs various events and/or sessions to a MySQL database. These events include logon, logoff, lock, unlock, console connect/disconnect, and others.
Along with the time of each event, the plugin also logs the host name, IP address, and machine name of the machine that generated the event.

This plugin expects a specific table schema. The table can be created using the configuration utility (see below).


MySQL Logger configuration


Event Mode

Event mode logs individual events to the database, one event per entry. An example excerpt from an Event table is below:

TimeStamp Host Ip Machine Message
2012-05-31 13:20:05 PC-23 PC-23 [0] Logon user: Bob Loblaw
2012-05-31 13:35:35 PC-23 PC-23 [0] Session lock user: Bob Loblaw
2012-05-31 13:37:35 PC-28 PC-28 [0] Logon user: Michael Bluth
2012-05-31 13:45:57 PC-23 PC-23 [0] Session unlock user: Bob Loblaw
2012-05-31 13:57:74 PC-23 PC-23 [0] Logoff user: Bob Loblaw

Session Mode

Session mode logs each login session, allowing you to keep track of when computers and people are logged into the computers. If you used the MySQL Logger from pGina 1.x/2.x, this plugin replicates that behavior.

A zero’d timestamp indicates the user has not yet logged out. In the event the system is shut down automatically without invoking the MySQL Logger plugin (e.g. power loss), the logout stamp will be set the next time someone logs in.

An example excerpt from a Session table is below:

dbid loginstamp logoutstamp username machine ipaddress
551 2012-05-31 13:20:05 2012-05-31 13:45:57 Bob Loblaw PC-23
552 2012-05-31 13:37:35 0000-00-00 00:00:00 Michael Bluth PC-28


The ”Test” button initiates a test of the MySQL connection, and verifies that the log table exists and is properly formatted.

The ”Create Table” button attempts to connect to the MySQL server and create the log table.

Table Schema

In the event you do not wish to have the plugin create the tables for you, the schema has been replicated below:

Event Table:

CREATE TABLE event_table (
   TimeStamp DATETIME,
   Ip VARCHAR(15),
   Machine TINYTEXT,
   Message TEXT 

Session Table:

CREATE TABLE session_table (
    loginstamp DATETIME NOT NULL,
    logoutstamp DATETIME NOT NULL,
    username TEXT NOT NULL,
    machine TEXT NOT NULL,
    ipaddress TEXT NOT NULL,
    INDEX (dbid)