Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 43.2Mb
PDF (A4) - 43.3Mb
Man Pages (TGZ) - 296.3Kb
Man Pages (Zip) - 401.6Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Priority-Based Error Log Filtering (log_filter_internal)

7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)

The log_filter_internal log filter component implements a simple form of log filtering based on error event priority and error code. To affect how log_filter_internal permits or suppresses error, warning, and information events intended for the error log, set the log_error_verbosity and log_error_suppression_list system variables.

log_filter_internal is built in and enabled by default. If this filter is disabled, log_error_verbosity and log_error_suppression_list have no effect, so filtering must be performed using another filter service instead where desired (for example, with individual filter rules when using log_filter_dragnet). For information about filter configuration, see Section 7.4.2.1, “Error Log Configuration”.

Verbosity Filtering

Events intended for the error log have a priority of ERROR, WARNING, or INFORMATION. The log_error_verbosity system variable controls verbosity based on which priorities to permit for messages written to the log, as shown in the following table.

log_error_verbosity Value Permitted Message Priorities
1 ERROR
2 ERROR, WARNING
3 ERROR, WARNING, INFORMATION

If log_error_verbosity 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 Section B.3.2.9, “Communication Errors and Aborted Connections”.

If you use replication, a log_error_verbosity value of 2 or greater is recommended, to obtain more information about what is happening, such as messages about network failures and reconnections.

If log_error_verbosity 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.

There is also a message priority of SYSTEM that is not subject to verbosity filtering. System messages about non-error situations are printed to the error log regardless of the log_error_verbosity value. These messages include startup and shutdown messages, and some significant changes to settings.

In the MySQL error log, system messages are labeled as System. 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 Note or Information. 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.

Suppression-List Filtering

The log_error_suppression_list system variable applies to events intended for the error log and specifies which events to suppress when they occur with a priority of WARNING or INFORMATION. For example, if a particular type of warning is considered undesirable noise in the error log because it occurs frequently but is not of interest, it can be suppressed. log_error_suppression_list does not suppress messages with a priority of ERROR or SYSTEM.

The log_error_suppression_list 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 MY- prefix. Leading zeros in the numeric part are not significant. Examples of permitted code formats:

ER_SERVER_SHUTDOWN_COMPLETE
MY-000031
000031
MY-31
31

For readability and portability, symbolic values are preferable to numeric values.

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:

  • 1 to 999: Global error codes that are used by the server as well as by clients.

  • 10000 and higher: Server error codes intended to be written to the error log (not sent to clients).

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 log_error_suppression_list value remains unchanged.

For information about error code ranges and the error symbols and numbers defined within each range, see Section B.1, “Error Message Sources and Elements”, and MySQL 8.0 Error Message Reference.

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 log_error_suppression_list depends on its priority. Suppose that the variable has a value of 'ER_PARSER_TRACE,MY-010001,10002'. Then log_error_suppression_list has these effects on messages for those codes:

  • Messages generated with a priority of WARNING or INFORMATION are suppressed.

  • Messages generated with a priority of ERROR or SYSTEM are not suppressed.

Verbosity and Suppression-List Interaction

The effect of log_error_verbosity combines with that of log_error_suppression_list. Consider a server started with these settings:

[mysqld]
log_error_verbosity=2     # error and warning messages only
log_error_suppression_list='ER_PARSER_TRACE,MY-010001,10002'

In this case, log_error_verbosity permits messages with ERROR or WARNING priority and discards messages with INFORMATION priority. Of the nondiscarded messages, log_error_suppression_list discards messages with WARNING priority and any of the named error codes.

Note

The log_error_verbosity value of 2 shown in the example is also its default value, so the effect of this variable on INFORMATION messages is as just described by default, without an explicit setting. You must set log_error_verbosity to 3 if you want log_error_suppression_list to affect messages with INFORMATION priority.

Consider a server started with this setting:

[mysqld]
log_error_verbosity=1     # error messages only

In this case, log_error_verbosity permits messages with ERROR priority and discards messages with WARNING or INFORMATION priority. Setting log_error_suppression_list has no effect because all error codes it might suppress are already discarded due to the log_error_verbosity setting.