7.4.2.7 Error Logging in JSON Format (original) (raw)
7.4.2.7 Error Logging in JSON Format
This section describes how to configure error logging using the built-in filter, log_filter_internal
, and the JSON sink, log_sink_json
, to take effect immediately and for subsequent server startups. For general information about configuring error logging, seeSection 7.4.2.1, “Error Log Configuration”.
To enable the JSON sink, first load the sink component, then modify the log_error_services value:
INSTALL COMPONENT 'file://component_log_sink_json';
SET PERSIST log_error_services = 'log_filter_internal; log_sink_json';
To set log_error_services to take effect at server startup, use the instructions atSection 7.4.2.1, “Error Log Configuration”. Those instructions apply to other error-logging system variables as well.
It is permitted to name log_sink_json
multiple times in thelog_error_services value. For example, to write unfiltered events with one instance and filtered events with another instance, you could setlog_error_services like this:
SET PERSIST log_error_services = 'log_sink_json; log_filter_internal; log_sink_json';
The JSON sink determines its output destination based on the default error log destination, which is given by thelog_error system variable. Iflog_error names a file, the JSON sink 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_filename
_, successive instances oflog_sink_json
named in thelog_error_services value write to_`filename`_.00.json
,_`filename`_.01.json
, and so forth.
If log_error isstderr
, the JSON sink writes to the console. If log_sink_json
is named multiple times in the log_error_services value, they all write to the console, which is likely not useful.