The SQL_ERROR_LOG
plugin was first released in MariaDB 5.5.22.
The SQL_ERROR_LOG
plugin collects errors sent to clients in a log file defined by sql_error_log_filename
, so that they can later be analyzed. The log file can be rotated if sql_error_log_rotate
is set.
Comments are also logged, which can make the log easier to search. But this is only possible if the client does not strip the comments away. For example, mysql
command-line client only leaves comments when started with the --comments
option.
It is implemented as a MYSQL_AUDIT_PLUGIN
.
Although the plugin's shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.
The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME
or INSTALL PLUGIN
. For example:
INSTALL SONAME 'sql_errlog';
The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load
or the --plugin-load-add
options. This can be specified as a command-line argument to mysqld
or it can be specified in a relevant server option group in an option file. For example:
[mariadb] ... plugin_load_add = sql_errlog
You can uninstall the plugin dynamically by executing UNINSTALL SONAME
or UNINSTALL PLUGIN
. For example:
UNINSTALL SONAME 'sql_errlog';
If you installed the plugin by providing the --plugin-load
or the --plugin-load-add
options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
install plugin SQL_ERROR_LOG soname 'sql_errlog'; Query OK, 0 rows affected (0.00 sec) use test; Database changed set sql_mode='STRICT_ALL_TABLES,NO_ENGINE_SUBSTITUTION'; Query OK, 0 rows affected (0.00 sec) CREATE TABLE foo2 (id int) ENGINE=WHOOPSIE; ERROR 1286 (42000): Unknown storage engine 'WHOOPSIE' \! cat data/sql_errors.log 2013-03-19 9:38:40 msandbox[msandbox] @ localhost [] ERROR 1286: Unknown storage engine 'WHOOPSIE' : CREATE TABLE foo2 (id int) ENGINE=WHOOPSIE
Version | Status | Introduced |
---|---|---|
1.0 | Stable | MariaDB 10.1.13 |
1.0 | Gamma | MariaDB 10.0.10 |
1.0 | Alpha | MariaDB 5.5.22 |
sql_error_log_filename
sql_error_log_filename.001
--sql-error-log-filename=value
string
sql_errors.log
sql_error_log_rate
SET sql_error_log_rate=300;
means that one of 300 errors will be written to the log.sql_error_log_rate
is 0
the logging is disabled.1
(every error is logged). --sql-error-log-rate=#
numeric
1
sql_error_log_rotate
--sql-error-log-rotate={0|1}
boolean
OFF
sql_error_log_rotations
9
. --sql-error-log-rotations
numeric
9
1
to 999
sql_error_log_size_limit
--sql-error-log-size-limit=#
numeric
1000000
100
to 9223372036854775807
sql_error_log
OFF
- Disables the plugin without removing it from the mysql.plugins
table. ON
- Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled. FORCE
- Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. FORCE_PLUS_PERMANENT
- Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME
or UNINSTALL PLUGIN
while the server is running. --sql-error-log=value
enumerated
ON
OFF
, ON
, FORCE
, FORCE_PLUS_PERMANENT
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/sql-error-log-plugin/