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 logged Description
timestamp Time at which the event occurred. If syslog is used, the format is defined by syslogd.
syslog_host Host from which the syslog entry was received.
syslog_ident For identifying a system log entry, including the MariaDB server.
syslog_info For providing information for identifying a system log entry.
serverhost The MariaDB server host name.
username Connected user.
host Host from which the user connected.
connectionid Connection ID number for the related operation.
queryid Query ID number, which can be used for finding the relational table events and related queries. For TABLE events, multiple lines will be added.
operation Recorded action type: CONNECT, QUERY, READ, WRITE, CREATE, ALTER, RENAME, DROP.
database Active database (as set by USE).
object Executed query for QUERY events, or the table name in the case of TABLE events.
retcode Return 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).

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.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.