MariaDB Audit Plugin - Log Format

The audit plugin logs user access to MariaDB and its objects. The audit trail (i.e., audit log) is a set of records, written as a list of fields to a file in a plain‐text format. The fields in the log are separated by commas. The format used for the plugin's own log file is slightly different from the format used if it logs to the system log because it has its own standard format. The general format for the logging to the plugin's own file is defined like the following:


If the server_audit_output_type variable is set to syslog instead of the default, file, the audit log file format will be as follows:

Item loggedDescription
timestampTime at which the event occurred. If syslog is used, the format is defined by syslogd.
syslog_hostHost from which the syslog entry was received.
syslog_identFor identifying a system log entry, including the MariaDB server.
syslog_infoFor providing information for identifying a system log entry.
serverhostThe MariaDB server host name.
usernameConnected user.
hostHost from which the user connected.
connectionidConnection ID number for the related operation.
queryidQuery ID number, which can be used for finding the relational table events and related queries. For TABLE events, multiple lines will be added.
operationRecorded action type: CONNECT, QUERY, READ, WRITE, CREATE, ALTER, RENAME, DROP.
databaseActive database (as set by USE).
objectExecuted query for QUERY events, or the table name in the case of TABLE events.
retcodeReturn code of the logged operation.

Various events will result in different audit records. Some events will not return a value for some fields (e.g., when the active database is not set when connecting to the server).

Below is a generic example of the output for connect events, with placeholders representing data. These are events in which a user connected, disconnected, or tried unsuccessfully to connect to the server.


Here is the one audit record generated for each query event:

[timestamp],[serverhost],[username],[host],[connectionid],[queryid],QUERY,[database],[object], [retcode]

Below are generic examples of records that are entered in the audit log for each type of table event:


Starting in version 1.2.0, passwords are hidden in the log for certain types of queries. They are replaced with asterisks for GRANT, CREATE USER, CREATE MASTER, CREATE SERVER, and ALTER SERVER statements. Passwords, however, are not replaced for the PASSWORD() and OLD_PASSWORD() functions when they are used inside other SQL statements (i.e., SET PASSWORD).


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.