Skip to main content

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

VariableDescriptionDefault
mysql-auditlog_filenameBase name for audit log files (8-digit progressive number appended)""
mysql-auditlog_filesizeMaximum 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

EventDescription
MySQL_Client_Connect_OKSuccessful client connection
MySQL_Client_Connect_ERRFailed client connection
MySQL_Client_CloseConnection closed by server
MySQL_Client_QuitConnection closed by client
MySQL_Client_Init_DBSchema change
Admin_Connect_OKSuccessful admin connection
Admin_Connect_ERRFailed admin connection
Admin_CloseAdmin connection closed
Admin_QuitAdmin connection quit

JSON Log Format

Each log entry contains:

FieldDescription
client_addrClient IP:port
proxy_addrProxySQL bind interface (MySQL module only)
eventConnection event type
usernameConnected user
schemanameDatabase name
sslBoolean SSL usage indicator
thread_idSession identifier
timestamp / timeEvent timing with millisecond precision
creation_timeSession start (close events only)
durationSession lifetime (close events only)
extra_infoAdditional context

Future Extensions

Support is planned for COM_CHANGE_USER, SQLite3 Server Module, and ClickHouse Module events.