<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="audit-log">
      </a>
      8.4.5 MySQL Enterprise Audit
     </h3>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="audit-log-elements.html">
       8.4.5.1 Elements of MySQL Enterprise Audit
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-installation.html">
       8.4.5.2 Installing or Uninstalling MySQL Enterprise Audit
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-security.html">
       8.4.5.3 MySQL Enterprise Audit Security Considerations
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-file-formats.html">
       8.4.5.4 Audit Log File Formats
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-logging-configuration.html">
       8.4.5.5 Configuring Audit Logging Characteristics
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-file-reading.html">
       8.4.5.6 Reading Audit Log Files
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-filtering.html">
       8.4.5.7 Audit Log Filtering
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-filter-definitions.html">
       8.4.5.8 Writing Audit Log Filter Definitions
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-disabling.html">
       8.4.5.9 Disabling Audit Logging
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-legacy-filtering.html">
       8.4.5.10 Legacy Mode Audit Log Filtering
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-reference.html">
       8.4.5.11 Audit Log Reference
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="audit-log-restrictions.html">
       8.4.5.12 Audit Log Restrictions
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <a class="indexterm" name="idm46045238633344">
  </a>
  <a class="indexterm" name="idm46045238632272">
  </a>
  <a class="indexterm" name="idm46045238630784">
  </a>
  <a class="indexterm" name="idm46045238629712">
  </a>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    MySQL Enterprise Audit is an extension included in MySQL Enterprise Edition, a commercial
        product. To learn more about commercial products, see
    <a class="ulink" href="https://www.mysql.com/products/" target="_blank">
     https://www.mysql.com/products/
    </a>
    .
   </p>
  </div>
  <p>
   MySQL Enterprise Edition includes MySQL Enterprise Audit, implemented using a server plugin named
   <code class="literal">
    audit_log
   </code>
   . MySQL Enterprise Audit uses the open MySQL Audit
      API to enable standard, policy-based monitoring, logging, and
      blocking of connection and query activity executed on specific
      MySQL servers. Designed to meet the Oracle audit specification,
      MySQL Enterprise Audit provides an out of box, easy to use auditing and
      compliance solution for applications that are governed by both
      internal and external regulatory guidelines.
  </p>
  <p>
   When installed, the audit plugin enables MySQL Server to produce a
      log file containing an audit record of server activity. The log
      contents include when clients connect and disconnect, and what
      actions they perform while connected, such as which databases and
      tables they access. You can add statistics for the time and size
      of each query to detect outliers.
  </p>
  <p>
   By default, MySQL Enterprise Audit uses tables in the
   <code class="literal">
    mysql
   </code>
   system database for persistent storage of filter and user account
      data. To use a different database, set the
   <a class="link" href="audit-log-reference.html#sysvar_audit_log_database">
    <code class="literal">
     audit_log_database
    </code>
   </a>
   system
      variable at server startup.
  </p>
  <p>
   After you install the audit plugin (see
   <a class="xref" href="audit-log-installation.html" title="8.4.5.2 Installing or Uninstalling MySQL Enterprise Audit">
    Section 8.4.5.2, “Installing or Uninstalling MySQL Enterprise Audit”
   </a>
   ), it writes an audit log
      file. By default, the file is named
   <code class="filename">
    audit.log
   </code>
   in the server data directory. To change the name of the file, set
      the
   <a class="link" href="audit-log-reference.html#sysvar_audit_log_file">
    <code class="literal">
     audit_log_file
    </code>
   </a>
   system
      variable at server startup.
  </p>
  <p>
   By default, audit log file contents are written in new-style XML
      format, without compression or encryption. To select the file
      format, set the
   <a class="link" href="audit-log-reference.html#sysvar_audit_log_format">
    <code class="literal">
     audit_log_format
    </code>
   </a>
   system variable at server startup. For details on file format and
      contents, see
   <a class="xref" href="audit-log-file-formats.html" title="8.4.5.4 Audit Log File Formats">
    Section 8.4.5.4, “Audit Log File Formats”
   </a>
   .
  </p>
  <p>
   For more information about controlling how logging occurs,
      including audit log file naming and format selection, see
   <a class="xref" href="audit-log-logging-configuration.html" title="8.4.5.5 Configuring Audit Logging Characteristics">
    Section 8.4.5.5, “Configuring Audit Logging Characteristics”
   </a>
   . To perform
      filtering of audited events, see
   <a class="xref" href="audit-log-filtering.html" title="8.4.5.7 Audit Log Filtering">
    Section 8.4.5.7, “Audit Log Filtering”
   </a>
   . For descriptions of the
      parameters used to configure the audit log plugin, see
   <a class="xref" href="audit-log-reference.html#audit-log-options-variables" title="Audit Log Options and Variables">
    Audit Log Options and Variables
   </a>
   .
  </p>
  <p>
   If the audit log plugin is enabled, the Performance Schema (see
   <a class="xref" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
    Chapter 29,
    <i>
     MySQL Performance Schema
    </i>
   </a>
   ) has instrumentation for it.
      To identify the relevant instruments, use this query:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24119707"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token keyword">NAME</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%/alog/%'</span><span class="token punctuation">;</span></code></pre>
  </div>
 </div>
 <br/>
</div>
