Show your support! Vote for Navicat in the DBTA Awards today!

Press Releases

Enabling a Component

Component loading and unloading are achieved via the INSTALL COMPONENT and UNINSTALL COMPONENT SQL statements. For example:

INSTALL COMPONENT 'file://component_validate_password';
UNINSTALL COMPONENT 'file://component_validate_password';

A loader service handles component loading and unloading, and also lists loaded components in the mysql.component system table.

INSTALL COMPONENT loads components into the server and activates them immediately. The loader service also registers loaded components in the mysql.component system table. For subsequent server restarts, any components listed in mysql.component are loaded by the loader service during startup.

UNINSTALL COMPONENT deactivates components and unloads them from the server. The loader service also unregisters the components from the mysql.component system table so that they are no longer loaded during startup for subsequent server restarts.

To see which components are installed, use the statement:

SELECT * FROM mysql.component;

Error Log Filtering and Routing

Thanks to the new component architecture, log events can be filtered, and their output can be sent to multiple destinations in a variety formats, including JSON. Log events may even be routed to third-party products like the Navicat Monitor for additional processing and analysis.

Error log configuration is stored in the global log_error_services and log_error_verbosity variables, which are both stored in the global_variables table. Error log variables are prefixed with “log_error_”, so we can fetch both as follows:

mysql>select * from global_variables where VARIABLE_NAME like 'log_error_%';
+---------------------+----------------------------------------+
| VARIABLE_NAME       | VARIABLE_VALUE                         |
+---------------------+----------------------------------------+
| log_error_services  | log_filter_internal; log_sink_internal |
| log_error_verbosity | 2                                      |
+---------------------+----------------------------------------+

There are four available log components. These are stored in the lib/plugins directory, and have an extension of “.so”:

  • component_log_filter_dragnet.so

  • component_log_sink_json.so

  • component_log_sink_syseventlog.so

  • component_log_sink_test.so

Components can be subdivided into two types: filters and sinks.

  • Filter components implement filtering of error log events. If no filter component is enabled, no filtering occurs. Otherwise, any enabled filter component affects log events only for components listed later in the log_error_services variable.

  • Error log sink components are writers that implement error log output. If no sink component is enabled, no log output occurs. Some sink component descriptions refer to the default error log destination. This is the console or a file and is indicated by the log_error system variable.

To load a component, you need to specify its URN. This is made up of:

“file://” + [the filename without the .so extension]

For example, to load the writer to json component, you would enable it like this:

mysql> INSTALL COMPONENT 'file://component_log_sink_json';

mysql> SET GLOBAL log_error_services = 'log_filter_internal; log_sink_internal; 
log_sink_json';

mysql> select * from global_variables where VARIABLE_NAME like 'log_error_%';

+---------------------+-------------------------------------------------------+
| VARIABLE_NAME       | VARIABLE_VALUE                                        |
+---------------------+-------------------------------------------------------+
| log_error_services  | log_filter_internal; log_sink_internal; log_sink_json |
| log_error_verbosity | 2                                                     |
+---------------------+-------------------------------------------------------+

We’ll explore the error logging in MySQL 8 in greater detail in future blogs!