Rechercher dans le manuel MySQL

5.4.2.4 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 modeled 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 5.4.2.1, “Error Log Component 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.

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

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.4.2.10, “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 slave server, the slave 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 priority of SYSTEM. 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 writers 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.

Contents Haut

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.

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

Symbolic values are preferable to numeric values for readability and portability.

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 Appendix B, Errors, Error Codes, and Common Problems.

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:

  • Messages for those codes are suppressed if generated with a priority of WARNING or INFORMATION.

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

Contents Haut

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 would have no effect because all error codes it might suppress are already discarded due to the log_error_verbosity setting.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-error-log-priority-based-filtering.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut