Spec-Zone .ru
спецификации, руководства, описания, API

6.3.11.3. The Audit Log File

Audit log file contents are not encrypted. See Section 6.3.11.2, "Audit Log Plugin Security Considerations".

The audit log file is written as XML, using UTF-8 (up to 4 bytes per character). The root element is <AUDIT>. The closing </AUDIT> tag of the root element is written when the audit log plugin terminates, so the tag is not present in the file while the plugin is active.

The root element contains <AUDIT_RECORD> elements. Each <AUDIT_RECORD> element has an empty body; all audit record fields are represented by element attributes.

Here is a sample log file, reformatted slightly for readability:

<?xml version="1.0" encoding="UTF-8"?><AUDIT>  <AUDIT_RECORD    TIMESTAMP="2012-08-02T14:52:12"    NAME="Audit"    SERVER_ID="1"    VERSION="1"    STARTUP_OPTIONS="--port=3306"    OS_VERSION="i686-Linux"    MYSQL_VERSION="5.6.10-log"/>  <AUDIT_RECORD    TIMESTAMP="2012-08-02T14:52:41"    NAME="Connect"    CONNECTION_ID="1"    STATUS="0"    USER="root"    PRIV_USER="root"    OS_LOGIN=""    PROXY_USER=""    HOST="localhost"    IP="127.0.0.1"    DB=""/>  <AUDIT_RECORD    TIMESTAMP="2012-08-02T14:53:45"    NAME="Query"    CONNECTION_ID="1"    STATUS="0"    SQLTEXT="INSERT INTO t1 () VALUES()"/>  <AUDIT_RECORD    TIMESTAMP="2012-08-02T14:53:51"    NAME="Quit"    CONNECTION_ID="1"    STATUS="0"/>  <AUDIT_RECORD    TIMESTAMP="2012-08-06T14:21:03"    NAME="NoAudit"    SERVER_ID="1"/></AUDIT>

Attributes of <AUDIT_RECORD> elements have these characteristics:

Every <AUDIT_RECORD> element contains a set of mandatory attributes. Other optional attributes may appear depending on the audit record type.

The following attributes are mandatory in every <AUDIT_RECORD> element:

The following attributes are optional in <AUDIT_RECORD> elements. Many of them occur only for elements with specific values of the NAME attribute.