Audit Log
Overview
ProxySQL's Audit Log feature, introduced in version 2.0.5, tracks connection activities across the
database infrastructure. Enable it by configuring the mysql-auditlog_filename variable (default:
empty string — no logging).
Configuration Variables
| Variable | Description | Default |
|---|---|---|
mysql-auditlog_filename | Base name for audit log files (8-digit progressive number appended) | "" |
mysql-auditlog_filesize | Maximum file size before rotation (bytes) | 104857600 (100 MB) |
SET mysql-auditlog_filename='proxysql-audit';
LOAD MYSQL VARIABLES TO RUNTIME;
SAVE MYSQL VARIABLES TO DISK;
Logged Events
MySQL Module:
- Successful/failed authentication
- Graceful disconnect
- Closed connection
- Schema changes (
COM_INIT_DB)
Admin Module:
- Successful/failed authentication
- Graceful disconnect
- Closed connection
Event Types
| Event | Description |
|---|---|
MySQL_Client_Connect_OK | Successful client connection |
MySQL_Client_Connect_ERR | Failed client connection |
MySQL_Client_Close | Connection closed by server |
MySQL_Client_Quit | Connection closed by client |
MySQL_Client_Init_DB | Schema change |
Admin_Connect_OK | Successful admin connection |
Admin_Connect_ERR | Failed admin connection |
Admin_Close | Admin connection closed |
Admin_Quit | Admin connection quit |
JSON Log Format
Each log entry contains:
| Field | Description |
|---|---|
client_addr | Client IP:port |
proxy_addr | ProxySQL bind interface (MySQL module only) |
event | Connection event type |
username | Connected user |
schemaname | Database name |
ssl | Boolean SSL usage indicator |
thread_id | Session identifier |
timestamp / time | Event timing with millisecond precision |
creation_time | Session start (close events only) |
duration | Session lifetime (close events only) |
extra_info | Additional context |
Future Extensions
Support is planned for COM_CHANGE_USER, SQLite3 Server Module, and ClickHouse Module events.