pGina MySQL Logger Plugin Documentation
- Plugin Name: MySQL Logger
- Plugin Type: Notification
- Version: 3.1.x
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).
Configuration
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 | 192.168.1.123 | PC-23 | [0] Logon user: Bob Loblaw |
2012-05-31 13:35:35 | PC-23 | 192.168.1.123 | PC-23 | [0] Session lock user: Bob Loblaw |
2012-05-31 13:37:35 | PC-28 | 192.168.1.128 | PC-28 | [0] Logon user: Michael Bluth |
2012-05-31 13:45:57 | PC-23 | 192.168.1.123 | PC-23 | [0] Session unlock user: Bob Loblaw |
2012-05-31 13:57:74 | PC-23 | 192.168.1.123 | 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 | 192.168.1.123 |
552 | 2012-05-31 13:37:35 | 0000-00-00 00:00:00 | Michael Bluth | PC-28 | 192.168.1.128 |
Options
- Host – The IP or fully-qualified hostname of the MySQL server.
- Port – The port where the MySQL server process is listening.
- Database – The database containing the log table.
- Event Table – The table used to store events if event mode is enabled.
- Session Table – The table used to store sessions if session mode is enabled.
- User – The username to use when connecting to the MySQL server.
- Password – The password to use when connecting to the MySQL server.
- Events – The events that will be logged if event mode is enabled.
- Use Modified Name – The MySQL Logger will log the username entered by the user by default. If you would like to log the name after it has been modified (by the Modify Username or Single User Login plugins for example), check this.
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,
Host TINYTEXT,
Ip VARCHAR(15),
Machine TINYTEXT,
Message TEXT
)
Session Table:
CREATE TABLE session_table (
dbid BIGINT NOT NULL AUTO_INCREMENT,
loginstamp DATETIME NOT NULL,
logoutstamp DATETIME NOT NULL,
username TEXT NOT NULL,
machine TEXT NOT NULL,
ipaddress TEXT NOT NULL,
INDEX (dbid)
)