Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 34.7Mb
PDF (A4) - 34.7Mb
PDF (RPM) - 32.6Mb
HTML Download (TGZ) - 8.2Mb
HTML Download (Zip) - 8.3Mb
HTML Download (RPM) - 7.1Mb
Man Pages (TGZ) - 129.9Kb
Man Pages (Zip) - 185.4Kb
Info (Gzip) - 3.2Mb
Info (Zip) - 3.2Mb

MySQL 8.0 Reference Manual  /  ...  /  Error Logging in JSON Format

Pre-General Availability Draft: 2018-01-12 Error Logging in JSON Format

This section describes how to configure error logging using the built-in filter, log_filter_internal, and the JSON writer, log_sink_json, to take effect immediately and for subsequent server startups. For general configuration about configuring error logging, see Section, “Error Log Component Configuration”.

To enable the JSON writer, first load the writer component, then modify the log_error_services value:

INSTALL COMPONENT 'file://component_log_sink_json';
SET GLOBAL log_error_services = 'log_filter_internal; log_sink_json';

To set log_error_services to take effect at server startup, use the instructions at Section, “Error Log Component Configuration”. Those instructions apply to other error-logging system variables as well.

It is permitted to name log_sink_json multiple times in the log_error_services value. For example, to write unfiltered events with one instance and filtered events with another instance, you could set log_error_services like this:

SET GLOBAL log_error_services = 'log_sink_json; log_filter_internal; log_sink_json';

The JSON log writer determines its output destination based on the default error log destination, which is given by the log_error system variable. If log_error names a file, the JSON writer bases output file naming on that file name, plus a numbered .NN.json suffix, with NN starting at 00. For example, if log_error is file_name, successive instances of log_sink_json named in the log_error_services value write to file_name.00.json, file_name.01.json, and so forth.

If log_error is stderr, the JSON writer writes to the console. If log_json_writer is named multiple times in the log_error_services value, they all write to the console, which is likely not useful.

User Comments
Sign Up Login You must be logged in to post a comment.