<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="error-log-priority-based-filtering">
      </a>
      7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)
     </h4>
    </div>
   </div>
  </div>
  <p>
   The
   <code class="literal">
    log_filter_internal
   </code>
   log filter component
        implements a simple form of log filtering based on error event
        priority and error code. To affect how
   <code class="literal">
    log_filter_internal
   </code>
   permits or suppresses
        error, warning, and information events intended for the error
        log, set the
   <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
    <code class="literal">
     log_error_verbosity
    </code>
   </a>
   and
   <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
    <code class="literal">
     log_error_suppression_list
    </code>
   </a>
   system variables.
  </p>
  <p>
   <code class="literal">
    log_filter_internal
   </code>
   is built in and enabled
        by default. If this filter is disabled,
   <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
    <code class="literal">
     log_error_verbosity
    </code>
   </a>
   and
   <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
    <code class="literal">
     log_error_suppression_list
    </code>
   </a>
   have
        no effect, so filtering must be performed using another filter
        service instead where desired (for example, with individual
        filter rules when using
   <code class="literal">
    log_filter_dragnet
   </code>
   ).
        For information about filter configuration, see
   <a class="xref" href="error-log-configuration.html" title="7.4.2.1 Error Log Configuration">
    Section 7.4.2.1, “Error Log Configuration”
   </a>
   .
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-priority-based-filtering.html#error-log-verbosity-filtering" title="Verbosity Filtering">
       Verbosity Filtering
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-priority-based-filtering.html#error-log-suppression-filtering" title="Suppression-List Filtering">
       Suppression-List Filtering
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-priority-based-filtering.html#error-log-verbosity-suppression-interaction" title="Verbosity and Suppression-List Interaction">
       Verbosity and Suppression-List Interaction
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-verbosity-filtering">
       </a>
       Verbosity Filtering
      </h5>
     </div>
    </div>
   </div>
   <p>
    Events intended for the error log have a priority of
    <code class="literal">
     ERROR
    </code>
    ,
    <code class="literal">
     WARNING
    </code>
    , or
    <code class="literal">
     INFORMATION
    </code>
    . The
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    system
          variable controls verbosity based on which priorities to
          permit for messages written to the log, as shown in the
          following table.
   </p>
   <div class="informaltable">
    <table summary="Permitted log_error_verbosity values and corresponding permitted message priorities.">
     <colgroup>
      <col style="width: 40%"/>
      <col style="width: 40%"/>
     </colgroup>
     <thead>
      <tr>
       <th>
        log_error_verbosity Value
       </th>
       <th>
        Permitted Message Priorities
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td>
        1
       </td>
       <td>
        <code class="literal">
         ERROR
        </code>
       </td>
      </tr>
      <tr>
       <td>
        2
       </td>
       <td>
        <code class="literal">
         ERROR
        </code>
        ,
        <code class="literal">
         WARNING
        </code>
       </td>
      </tr>
      <tr>
       <td>
        3
       </td>
       <td>
        <code class="literal">
         ERROR
        </code>
        ,
        <code class="literal">
         WARNING
        </code>
        ,
        <code class="literal">
         INFORMATION
        </code>
       </td>
      </tr>
     </tbody>
    </table>
   </div>
   <p>
    If
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    is 2
          or greater, the server logs messages about statements that are
          unsafe for statement-based logging. If the value is 3, the
          server logs aborted connections and access-denied errors for
          new connection attempts. See
    <a class="xref" href="communication-errors.html" title="B.3.2.9 Communication Errors and Aborted Connections">
     Section B.3.2.9, “Communication Errors and Aborted Connections”
    </a>
    .
   </p>
   <p>
    If you use replication, a
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    value of
          2 or greater is recommended, to obtain more information about
          what is happening, such as messages about network failures and
          reconnections.
   </p>
   <p>
    If
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    is 2
          or greater on a replica, the replica prints messages to the
          error log to provide information about its status, such as the
          binary log and relay log coordinates where it starts its job,
          when it is switching to another relay log, when it reconnects
          after a disconnect, and so forth.
   </p>
   <p>
    There is also a message priority of
    <code class="literal">
     SYSTEM
    </code>
    that is not subject to verbosity filtering. System messages
          about non-error situations are printed to the error log
          regardless of the
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    value.
          These messages include startup and shutdown messages, and some
          significant changes to settings.
   </p>
   <p>
    In the MySQL error log, system messages are labeled as
    <span class="quote">
     “
     <span class="quote">
      System
     </span>
     ”
    </span>
    . Other log sinks might or might not
          follow the same convention, and in the resulting logs, system
          messages might be assigned the label used for the information
          priority level, such as
    <span class="quote">
     “
     <span class="quote">
      Note
     </span>
     ”
    </span>
    or
    <span class="quote">
     “
     <span class="quote">
      Information
     </span>
     ”
    </span>
    . If you apply any additional
          filtering or redirection for logging based on the labeling of
          messages, system messages do not override your filter, but are
          handled by it in the same way as other messages.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-suppression-filtering">
       </a>
       Suppression-List Filtering
      </h5>
     </div>
    </div>
   </div>
   <p>
    The
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    system variable applies to events intended for the error log
          and specifies which events to suppress when they occur with a
          priority of
    <code class="literal">
     WARNING
    </code>
    or
    <code class="literal">
     INFORMATION
    </code>
    . For example, if a particular
          type of warning is considered undesirable
    <span class="quote">
     “
     <span class="quote">
      noise
     </span>
     ”
    </span>
    in the error log because it occurs frequently but is not of
          interest, it can be suppressed.
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    does not suppress messages with a priority of
    <code class="literal">
     ERROR
    </code>
    or
    <code class="literal">
     SYSTEM
    </code>
    .
   </p>
   <p>
    The
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    value may be the empty string for no suppression, or a list of
          one or more comma-separated values indicating the error codes
          to suppress. Error codes may be specified in symbolic or
          numeric form. A numeric code may be specified with or without
          the
    <code class="literal">
     MY-
    </code>
    prefix. Leading zeros in the
          numeric part are not significant. Examples of permitted code
          formats:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-simple"><div class="docs-select-all right" id="sa44298534"><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-simple">ER_SERVER_SHUTDOWN_COMPLETE
MY<span class="token operator">-</span>000031
000031
MY<span class="token operator">-</span>31
31</code></pre>
   </div>
   <p>
    For readability and portability, symbolic values are
          preferable to numeric values.
   </p>
   <p>
    Although codes to be suppressed can be expressed in symbolic
          or numeric form, the numeric value of each code must be in a
          permitted range:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       1 to 999: Global error codes that are used by the server
              as well as by clients.
      </p>
     </li>
     <li class="listitem">
      <p>
       10000 and higher: Server error codes intended to be
              written to the error log (not sent to clients).
      </p>
     </li>
    </ul>
   </div>
   <p>
    In addition, each error code specified must actually be used
          by MySQL. Attempts to specify a code not within a permitted
          range or within a permitted range but not used by MySQL
          produce an error and the
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    value remains unchanged.
   </p>
   <p>
    For information about error code ranges and the error symbols
          and numbers defined within each range, see
    <a class="xref" href="error-message-elements.html" title="B.1 Error Message Sources and Elements">
     Section B.1, “Error Message Sources and Elements”
    </a>
    , and
    <a class="ulink" href="/doc/mysql-errors/8.4/en/" target="_top">
     MySQL 8.4 Error Message Reference
    </a>
    .
   </p>
   <p>
    The server can generate messages for a given error code at
          differing priorities, so suppression of a message associated
          with an error code listed in
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    depends on its priority. Suppose that the variable has a value
          of
    <code class="literal">
     'ER_PARSER_TRACE,MY-010001,10002'
    </code>
    . Then
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    has these effects on messages for those codes:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Messages generated with a priority of
       <code class="literal">
        WARNING
       </code>
       or
       <code class="literal">
        INFORMATION
       </code>
       are suppressed.
      </p>
     </li>
     <li class="listitem">
      <p>
       Messages generated with a priority of
       <code class="literal">
        ERROR
       </code>
       or
       <code class="literal">
        SYSTEM
       </code>
       are
              not suppressed.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-verbosity-suppression-interaction">
       </a>
       Verbosity and Suppression-List Interaction
      </h5>
     </div>
    </div>
   </div>
   <p>
    The effect of
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    combines
          with that of
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    .
          Consider a server started with these settings:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa87834400"><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-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">log_error_verbosity</span><span class="token attr-value"><span class="token punctuation">=</span>2     </span><span class="token comment" spellcheck="true"># error and warning messages only</span>
<span class="token constant">log_error_suppression_list</span><span class="token attr-value"><span class="token punctuation">=</span>'ER_PARSER_TRACE,MY-010001,10002'</span></code></pre>
   </div>
   <p>
    In this case,
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    permits
          messages with
    <code class="literal">
     ERROR
    </code>
    or
    <code class="literal">
     WARNING
    </code>
    priority and discards messages with
    <code class="literal">
     INFORMATION
    </code>
    priority. Of the nondiscarded
          messages,
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    discards messages with
    <code class="literal">
     WARNING
    </code>
    priority and
          any of the named error codes.
   </p>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     The
     <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
      <code class="literal">
       log_error_verbosity
      </code>
     </a>
     value of 2 shown in the example is also its default value,
            so the effect of this variable on
     <code class="literal">
      INFORMATION
     </code>
     messages is as just described
            by default, without an explicit setting. You must set
     <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
      <code class="literal">
       log_error_verbosity
      </code>
     </a>
     to 3 if
            you want
     <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
      <code class="literal">
       log_error_suppression_list
      </code>
     </a>
     to affect messages with
     <code class="literal">
      INFORMATION
     </code>
     priority.
    </p>
   </div>
   <p>
    Consider a server started with this setting:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa95561164"><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-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">log_error_verbosity</span><span class="token attr-value"><span class="token punctuation">=</span>1     </span><span class="token comment" spellcheck="true"># error messages only</span></code></pre>
   </div>
   <p>
    In this case,
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    permits
          messages with
    <code class="literal">
     ERROR
    </code>
    priority and discards
          messages with
    <code class="literal">
     WARNING
    </code>
    or
    <code class="literal">
     INFORMATION
    </code>
    priority. Setting
    <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
     <code class="literal">
      log_error_suppression_list
     </code>
    </a>
    has no effect because all error codes it might suppress are
          already discarded due to the
    <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
     <code class="literal">
      log_error_verbosity
     </code>
    </a>
    setting.
   </p>
  </div>
 </div>
 <br/>
</div>
